Frequently asked questions in Mulesoft interviews 2019
  • 1. Tell me about your project?
  • I am sure all the people usually face this question.
    In my case also, if I have to answer for this question, I usually starts with project oveview first and then about architecture.
    Always try not to share critical information about the project or just try to explain the basic of your current project.
  • 2. What are the connectors you have used?
  • Based on your experienses and based of usages of connectors in you project you should name the connectors. Here are some name of connectors present in Mulesoft :
    HTTP/HTTPS, FTP, SFTP, FTPS, Web Service Consumer, Amazon Simple Storage Service (S3), ActiveMQ, Salesforce, JDBC, Servlet, LDAP, PostgreSQL, Dropbox, LinkedIn, Zuora, Jetty, MongoDB, Facebook, JBoss, etc.
  • 3. How Scatter-Gather works?
    •   The routing message processor Scatter-Gather sends a request message to multiple targets concurrently. It collects the responses from all routes, and aggregates them into a single message.
    •   Scatter-Gather executes routes concurrently instead of sequentially.
    •   Parallel execution of routes can greatly increase the efficiency of our application and provides more information than sequential processing.
    •   The Scatter-Gather router sends a message for concurrent processing to all configured routes.
    •   The thread executing the flow that owns the router waits until all routes complete or time out.
    •   If there are no failures, Mule aggregates the results from each of the routes into a message collection (MessageCollection class).
    •   Failure in one route does not stop the Scatter-Gather from sending messages to its other configured routes, so it is possible that many, or all routes may fail concurrently.
    •   By default, if any route fails, Scatter-Gather performs the following actions:
      1. Sets the exception payload accordingly for each route
      2. Throws a CompositeRoutingException, which maps each exception to its corresponding route using a sequential route ID.
    •   Catching the CompositeRoutingException allows us to gather information on all failed routes.
  • 10. What is message Enricher?
    •   Appends information to a message, often using an expression to determine what part of the payload to evaluate so as to return an appropriate value to append to that payload.
    •   Consider a message from a source system contains a zip code but the target system needs the two letter state. A message enricher can be used to lookup the state using the zip code from an enrichment resource. The enricher calls out to the enrichment resource with the current message (containing the zip code) then enriches the current message with the result.
  • 11. What is the use of Mule Requester?
    •   As its name may hint, its goal is to allow the request of a resource at any point in a flow.
    •   This resource can be a file, a message (from VM, JMS, AMQP, etc.), an e-mail, etc. It’s intended for resources that originally could only be requested by message sources.
  • 15. Difference between Topic and Queue?
    • Topics
      In JMS a Topic implements publish and subscribe semantics.
      When we publish a message it goes to all the subscribers who are interested - so zero to many subscribers will receive a copy of the message.
      Only subscribers who had an active subscription at the time the broker receives the message will get a copy of the message.

    • Queues
      A JMS Queue implements load balancer semantics.
      A single message will be received by exactly one consumer.
      If there are no consumers available at the time the message is sent it will be kept until a consumer is available that can process the message.
      If a consumer receives a message and does not acknowledge it before closing then the message will be redelivered to another consumer.
      A queue can have many consumers with messages load balanced across the available consumers.

    • Summary
      • That means a topic is appropriate. A queue means a message goes to one and only one possible subscriber. A topic goes to each and every subscriber.
      • Topics are for the publisher-subscriber model, while queues are for point-to-point.
      • Queue is JMS managed object used for holding messages waiting for subscribers to consume. When all subscribers consumed the message , message will be removed from queue. Topic is that all subscribers to a topic receive the same message when the message is published.
  • 17. Configuration of SFTP connector?
  • The SFTP Connector implements a secure file transport channel so that our Mule application can exchange files with external resources. SFTP uses the SSH security protocol to transfer messages.
    We can implement the SFTP endpoint as an inbound endpoint with a one-way exchange pattern, or as an outbound endpoint configured for either a one-way or request-response exchange pattern.
    Host:- ft3.omni.com, Port:- 21, Path:- /AttendeeData, User:- User_1, Password:- Pass_1
  • 18. What is the scope in Mule?
  • Sometimes referred to as "wrappers", the message processors known as Scopes appear as processing blocks when we first place them on the Message Flow canvas.
    Scope available in Mule : Async, Cache, Composite Source, Foreach, Message Enricher, Poll, Sub Flow, Transactional, Until Successful
    • Async : Creates a block of message processors that execute asynchronously while the rest of the flow continues to execute in parallel.
    • Cache : Caches data produced by part of a flow. Wrap a cache scope around message processors in our flow so that it caches the response events produced within the scope.
    • Composite Source : To accept incoming messages from multiple input channels, place two or more message sources (also known as receivers) into a Composite Source.
    • Foreach : Splits any type of message collection apart into individual messages for processing, and then aggregate them again at the end of the scope.
    • Message Enricher : Appends information to a message, often using an expression to determine what part of the payload to evaluate so as to return an appropriate value to append to that payload.
    • Poll : Periodically polls an embedded message receiver for new messages.
    • Sub Flow : A flow that is called by another flow. Sub flows inherit their properties from the flow reference and are always synchronous. This type of scope can be very useful when we need to reuse code at several points within the same flow. Simply place (and configure) Flow Reference Components wherever we want the sub flow processing block to execute.
    • Transactional : Mule applies the concept of transactions to operations in application for which the result cannot remain indeterminate.
    • Until Successful : Attempts, at a specified interval, to route a message to an embedded message processor until one of the following occurs:
      1. It succeeds
      2. The maximum number of retries is reached
      3. An exception is thrown
      Thus, Until Successful can prove useful in sending messages to resources, such as shared printers, which might not always be immediately available.
  • 19. What is Flow Reference?
    • Use a flow reference component in flow to direct Mule to send a message to another flow for processing.
    • When a message reaches a flow reference component in a flow, Mule sends the message to another flow according to the configuration of the flow-ref attributes.
    • A flow reference can route messages to any type of flow within the same application. Refer to Flows and Subflows for more information.
  • 20. How to create custom transformers?
  • There are two ways to create a transformer:
    1. Use a Transformer Annotation on a method. This transformer will be automatically discovered and will be available to Mule’s automatic transformation engine.

    2. The traditional Mule way of creating custom transformers by extending AbstractTransformer
  • 22. How to call a flow from DataWeave?
  • From a DataWeave transform, we can trigger the calling of a different flow in our Mule application, and whatever the flow returns is what the expression returns.
    We can do this through the following expression:
    lookup(flowName,$)
    Which takes two parameters:
    1. The name of the flow that must be called.
    2. The payload to send to this flow, as a map
  • 23. What is VM? How to use?
  • We can use the Java Virtual Machine (VM) transport for intra-JVM communication between Mule flows.
    This transport by default uses in-memory queues but can optionally be configured to use persistent queues.
    Area to use VM : Inbound, Outbound, Request, Transactions, Streaming, Retries, MEPs, Default MEP, Maven Artifact
  • 24. What is message in Mule?
  • The Mule message is the data that passes through an application via one or more flows.
    It consists of two main parts:
    1. The message header, which contains metadata about the message.
    2. The message payload, which contains your business-specific data.
    Area to use VM : Inbound, Outbound, Request, Transactions, Streaming, Retries, MEPs, Default MEP, Maven Artifact
  • 25. What is Inbound, outbound, Invocation, Session properties?
    • Inbound Properties
      1. Inbound properties canít be set by you.
      2. Message sources (such as inbound endpoints) set them for you when they receive a message.
      3. Inbound properties are lost when crossing a transport barrier.

    • Outbound Properties
      1. Outbound properties can be set by you.
      2. Message sources (such as inbound endpoints) set them for you when they receive a message.
      3. When crossing a transport barrier, outbound properties are automatically turned into inbound properties, and no longer exist as outbound properties.

    • Invocation Properties
      1. Invocation properties can be set by you.
      2. Invocation properties are lost when crossing a transport barrier.

    • Session Properties
      1. Session properties can be set by you.
      2. Session properties are preserved when crossing a transport barrier.

    • Flow Variables
      1. They behave like instance properties.

    • Session Variables
      1. They behave like session properties.
  • 27. What is Private Flow?
  • A private flow is one that cannot be accessed from outside the JVM via a Mule Endpoint because it has no message source defined.
    Private Flows are therefore only used if they are referenced from another construct running in the same Mule instance.
    When configuring Mule using XML the flow-ref element is used to include one flow in another.
    A private Flow differs from the use of a "Processor Chain" in that a Flow has itís own context and exception strategy where as when a processor chain is referenced, it is executed in the context of the flow that references it.
  • 30. How can we maintain Cluster env in Cloud?
    1. Download and install Mule runtime on two or more physical or virtual servers in your site.
    2. Sign in to the Anypoint Platform and click Runtime Manager.
    3. Click the Servers tab and obtain the necessary token register each server to the platform via its command line.
    4. After all servers are registered and visible in the Servers tab, click Create Cluster. Servers can be added to a cluster in any status.
    5. Give the cluster a name.
    6. Choose Multicast or Unicast. For more information, see Multicast Versus Unicast.
    7. Click the checkboxes for the names of the servers to add to your cluster, and click Create Cluster.
  • 31. How can we maintain Cluster env in OnPrimes?
  • Mule Management Console (MMC) => centralizes management and monitoring functions for all your on-premise Mule ESB Enterprise deployments, whether they are running as standalone instances, as a cluster, or embedded in application servers.
    1. Ensure that the node is not running, that is that the Mule Runtime Server is stopped.
    2. Create a file named mule-cluster.properties inside the node’s $MULE_HOME/.mule directory.
    3. Edit the file with parameter = value pairs, one per line. See the example below.
    4. Repeat this procedure for all Mule servers that you want to be in the cluster.
    5. Start the Mule servers in the nodes.
      Example :
      • mule.cluster.nodes=192.168.10.21,192.168.10.22,192.168.10.23
      • mule.cluster.multicastenabled=false
      • mule.clusterId=Cluster_ID
      • mule.clusterNodeId=Cluster_Node_ID
  • 32. What is the purpose of DataWeave?
  • The DataWeave Language is a powerful template engine that allows you to transform data to and from any kind of format (XML, CSV, JSON, Pojos, Maps, etc).
  • 34. Can we define a function in DataWeave, If how?
  • We can define a function in the header, you can then call it in any part of the DataWeave body, including arguments.
    Example 1 :-
    %dw 1.0
    %output application/json
    %var toUser = (user) -> {firstName: user.name, lastName: user.lastName}
    ---
    { user: toUser(payload)}

    Example 2 :-
    %dw 1.0
    %output application/json
    %function toUser(user){firstName: user.name, lastName: user.lastName}
    ---
    { user: toUser(payload)}
  • 35. Difference between function and var in DataWeave?
  • There are two types of directives you can use to define a function, through %var (as with variables) using a lambda, or through %function.
    Example :-
    %dw 1.0
    %output application/json
    %var toUser = (user) -> {firstName: user.givenName, lastName: user.sn}
    ---
    {"user" : toUser({ givenName : "Annie", sn : "Point" })}

    Output : {"user": {"firstName": "Annie","lastName": "Point"}}


    We can declare functions in the Header and these can be invoked at any point in the Body. We refer to them as you do to any variable or constant: using the form function-name() passing an expression as argument. The result of the expression that is passed as an argument is used in the execution of the function body.
    Example :-
    %dw 1.0
    %output application/json
    %function toUser(user){firstName: user.givenName, lastName: user.sn}
    ---
    {"user" : toUser({ givenName : "Annie", sn : "Point" })}

    Output : {"user": {"firstName": "Annie","lastName": "Point"}}


  • 37. What is the difference between 3.7 and 3.8 runtime?
  • New Features of 3.8 :
    1. Unified API Gateway and Mule runtimes
    2. Early Access RAML 1.0
    3. HTTP Requester DNS improvements
    4. TLS Improvements
    5. DataWeave Fixed Width, Flat File and COBOL Copybook
    6. Mule HA Quorums and Persistent Storage
    7. Client Id enforcement policy with Basic Authentication
    8. Gatekeeper: Enhanced security on startup
    9. Policy order improvements
    10. Support for X-Forwarded-For headers
    11. Persistence of throttling and rate limiting quota
If hope this chapter, Most asked questions in interviews helps you to know about the difficulty and imporance of topics that you have to look into before attend an interview.
Apart from Mulesoft 3 I am working on other projects also, kindly follow if you are interested on.

Comments