MuleSoft Scenario Questions & Answers
MuleSoft Scenario Questions & Answers
MuleSoft Scenario Questions & Answers
2. Define a VM connector
6. Verification
Link: https://www.slideshare.net/kumargaurav66/mulesoft-calling-flow-of-other-applications
Swagger:
Swagger open source and pro tools have helped millions of API developers, teams, and
organizations deliver great APIs.
Swagger (now OAS) and RAML are two of the most popular specifications for developing APIs
on the market right now.
Swagger—recently renamed to Open API** or OAS—is a type of framework that was designed
to describe, produce, visualize, and consume RESTful web services.
payload is :null should work as NullPaylod is mapped to null value. Also payload == null
In mule I have a flow that receive an InputStream with a 500mb xml file. I want to split the
xml file following certain rules. The result is 390000 messages that I need to send to an
ActiveMQ queue. ActiveMQ will give an outofmemory exception if I send all messages in
one transaction. If I don't use transaction it will succeed but it will be much slower.
What's the best way to send the messages in batches of 1000? Can I use standard
components?
I think what you are looking for batch commits doc here. This component will execute the
internal flow components once he collected the specified numbers of records. Batch commit
processor is allowed only inside a batch step.
Consuming Flow
1. It will have JMS as a consumer and a File component to write the message.
2. JMS: It will be configured the same way as we have configured in the first flow.
XML Parsing
1. if you want to parse XML file and extract values of elements you can use XPATH
2. If you want your output to be an xml and values need to be mapped, you can use XSLT
Transformer
Spring:
Mule as an ESB and the Spring Framework are a powerful combination with a rich history of
successful production deployments.
Use Cases: To execute the basic operations to store and retrieve the documents from
MongoDB through Mule Flow.
1. MongoDB Setup.
4. Execute the flow to retrieve the document saved. Operation - Find one document)
The MongoDB connector has the capability to store and retrieve documents from the Mule flow
efficiently and with minimal configuration. MongoDB generates a unique ID for each document.
How to Load Balance Mule ESB without using Mule Management Console
For load balancing incoming HTTP request, over multiple Mule instances, you will need a
external loadbalancer. Mule ESB Enterprise Edition nor MMC will help you with that. You can
use a commercial one, such as a F5 BIP-IP, or setup a HAProxy. To avoid the loadbalancer to
be a single point of failure you can setup a redundant HAProxy.
For JMS make sure to setup a external message broker cluster and connect to it using the
normal jms:inbound-endpoint that way Mule will act as a competing consumer and you will
achieve load balancing of messages.
Consumer applications invoke your services. APIs route to the endpoints that the gateway
exposes to enforce runtime policies and collect and track analytics data. using the API
Gateway we can To manage an existing Mule API To deploy a proxy
API Gateway supports the following MuleSoft connectors only: HTTP/S ,Jetty,File,JDBC,WS-
Consumer connectors
The advantage of using a proxy is having a layer of separation to ensure that any attacks
against our API are stopped well before anyone interacts with our main servers. This creates
extra protection for our existing APIs.
API Gateway acts as a proxy server that is dedicated to hosting the proxy applications and for
Lightning Connect to gather all the existing backend APIs together which are either hosted in
our on-premises standalone server or CloudHub.
The advantage of API Gateway is that it automatically creates an application that can proxy the
backend API from the URL that the backend API exposes, and we do not need to write any
code for it. Not only that, through API Manager, we can implement various runtime policies on
HTTP/HTTPS endpoints to govern our proxy API.
API Gateway solution is also very versatile, as it can be implemented both in CloudHub as well
as in on-premises.
Mule is an another implementation of ESB, but not related to the Camel/ServiceMix family.
What are all integration pattern used in Mulesoft? Give some integration pattern names
and relate them with the Mulesoft connector/component/transformer.
Migration is the act of moving a specific set of data at a point in time from one system to the
other(Database Connectors, Sales Force Connector, etc)
Broadcast can also be called “one way sync from one to many”, and it is the act of moving
data from a single source system to many destination systems in an ongoing and real-time (or
near real-time), basis. (JMS Topic - Pub/Sub)
The bi-directional sync data integration pattern is the act of combining two datasets in two
different systems so that they behave as one, while respecting their need to exist as different
datasets
Aggregation is the act of taking or receiving data from multiple systems and inserting into one
Choice Router - The Choice router in Mule is an implementation of the Content-Based Router
enterprise integration pattern. It examines the message content and routes the message onto a
different channel, based on data contained in the message.
System layer API: This is the foundational layer of the three-layer architecture. These APIs can
be defined for various domains of an organization, for example, ERP, key customer and billing
systems, proprietary databases, etc
One can modify the System API logic without affecting the other APIs (Process and
Experience)
Process layer APIs are responsible for shaping the data by orchestrating and choreographing
various data by calling multiple System APIs. The orchestration involves the aggregating,
splitting, and routing of data. The main purpose of Process APIs is to strictly encapsulate the
business process independent of the source systems (System APIs) from which the data
originates. Common business logic can be shared across the organization. (e.g. Purchase
Order Process API)
Experience APIs are the means by which data can be reconfigured easily to meet the needs of
multiple audiences. The Experience APIs are the ones which should be exposed publicly for
consumption. Basically, they involve only the transformation of data. So, to meet a wide range
of clients that accept data in diverse formats
Composite APIs are a design approach to batch API requests sequentially into a single API
call. Rather than multiple round trips to a server, a client can make one API request with a chain
of calls and receive one response.
If you have flow where synchronous processing required but it has two flow running in
sequence. 1 is in synchronous and other one is calling aync flow then how would you get
response in such scenarios in synchronous manner?
Scatter Gather
Did you deploy api on cloudhub if yes then what process was followed?
• In Studio, open your application as a Mule Project.
• In Package Explorer, right-click the project node, then select Anypoint Platform, then
Deploy to CloudHub.
• If this is your first time deploying from Studio, a popup dialog box asks you to provide your
login credentials for Anypoint Platform. Studio stores your credentials and uses them
automatically the next time you deploy to CloudHub.
• If you are using the HTTP Listener as source for your flow, you need to set its host to
0.0.0.0 and its port to ${http.port}
Load Balancing:
If your app runs on multiple workers, the CloudHub shared load automatically balances
incoming traffic.
Alternatively, you can use the optional dedicated load balancer (DLB) component to route
external traffic to multiple Mule applications deployed to CloudHub workers in Anypoint Virtual
Private Cloud (VPC).
What are all NFR you need to consider while deciding workers/core for cloudhub application?
Can you change the flow processing strategies and what are all parameter you need to
consider while deciding on processing strategies?
• The flow processing strategy is automatically set.
• This is usually done when a custom queued-asynchronous profile has been created for
tuning application performance.
Standard queues attempt to preserve the order of messages, but strict order is not guaranteed.
Because standard queues are designed to be scalable and distributed, they can’t guarantee
that messages are received in the same order that they are sent. You can fetch up to 50
messages from a standard (non-FIFO) queue. Anypoint MQ supports up to 120,000 in-flight
messages per standard queue.
FIFO: For a FIFO queue, you can fetch up to 10 messages. The FIFO restriction exists because
the FIFO queues are limited to 10 in-flight messages per message group. With FIFO queues,
Anypoint MQ ensures that the order in which messages are placed in a queue is the same
order messages are retrieved. However, if you batch 10 messages per each read and write
operation (maximum) using the API, FIFO queues can support up to 3,000 TPS.
How do you get requirement for the APIs and what overall process you follow from
design to deployment.
Functional Requirements
Synchronous: If an API call is synchronous, it means that code execution will block (or wait)
for the API call to return before continuing. This means that until a response is returned by the
API, your application will not execute any further. Its kind of performance issue in your app.
some times synchronous call do not have performance issue like -if there is code in your app
that will only execute properly once the API response is received.
Asynchronous: Asynchronous calls do not block (or wait) for the API call to return from the
server. Execution continues on in your program, and when the call returns from the server, a
“callback” function is executed.
The important point is that program execution will continue, and asynchronously, the callback
function will be called once program execution completes.
• JWT
• OAuth
• To apply the OAuth 2.0 policy, the below configuration needs to be done.
• OAuth 2.0 policy needs to be applied on the API, the OAuth provider authorized, and the
access-token URL needs to be configured in the API specification along with scope.
If you need to save state of the transaction and then resume it if it fails. How would you
do it?
Rollback Strategy Exception Strategy
You can define a rollback exception strategy to ensure that a message that throws an
exception in a flow is rolled back for reprocessing. Use a rollback exception strategy when you
cannot correct an error that occurs in a flow. Usually, you use a rollback exception strategy to
handle errors that occur in a flow that involve a transaction. If the transaction fails, that is, if a
message throws an exception while being processed, then the rollback exception strategy rolls
back the transaction in the flow. If the inbound connector is transactional, Mule delivers the
message to the inbound connector of the parent flow again to reattempt processing (that is,
message redelivery).
---------------------
2. How do you handled the messages like if backend system is not available to pick the
messages once it posted on MQ?
Fan Out primitive is used to fire the input message through output terminal once or multiple
times. Fan Out can be used alone or as a combination of Fan Out and Fan In.
Fan In always acts as a decision point whether to continue or stop flow execution and it is
always combined with Fan Out. Until a decision point is reached, Fan In receives a number of
messages and the last message received are sent to the output terminal.
3. If you don’t know anything about a topic or technology. What approach do you use to
learn things ?
5. How do you get requirements for the user story ? Do you use any tools like JIRA ?
9. What are the steps you follow to understand and complete a project?
Start with Design center, and write the raml , use mock servise to test, publish to exchange,
write the API documentation in the Exchange
then we use this raml to write our implementation flows and deploy to Mule Runtime
What are traits in ramls, give some examples ? How can you reuse?
by making them reusabe and fragments and including it in the raml we can reuse
SOAP stands for Simple Object Access Protocol. SOAP is a protocol. SOAP was designed with
a specification. It includes a WSDL file which has the required information on what the web
service does in addition to the location of the web service.
REST stands for Representational State Transfer. REST is an Architectural style in which a web
service can only be treated as a RESTful service if it follows the constraints of being
Client Server
Stateless
Cacheable
Layered System
Uniform Interface
what are the http methods ( GET, POST, PUT, DELETE) what each of these methods means ?
The PATCH method is a request method supported by the HTTP protocol for making partial
changes to an existing resource.
-Http Listener,
-VM Listener,
JMS Listener
What is Scheduler?
The Scheduler component enables you to trigger a flow when a time-based condition is met.
You can configure it to be triggered at a regular interval or give it a more flexible cron
expression. For example, a Scheduler might trigger an event to start a flow every 5 seconds.
What is Watermarking?
Watermarking is typically used to perform data synchronization. Watermarking is a technique
for storing and retrieving the point at which a periodic synchronization should resume the next
time it’s executed. Watermarking is a typically used alongside ObjectStore
- Error Handling
- on Error Continue
On-Error Continue catches the error and does not report it as an error, thus the processing of
the flow continues even after the error has occurred. This error handler can be used in flows
where you don’t want to stop the flow processing even if an error has occurred.
- on Error Propogate
On-Error Propagate works exactly as the Mule 3 Catch exception strategy. In case of any
errors, On-Error Propagate processes the error message and re-throws the error to its parent
flow. No further processing is done on that particular flow.
- Raise Error
This core component generates a Mule error, as if a failure had occurred, which allows you to
customize its description and type.
Queued-Asynchronous Flow Processing Strategy : Mule uses a queue to decouple the receiver
thread from the rest of the flow.
- Bi directonal Synchronization (For Example first time you will load all the data after
that we can use watermarking)
- File transfer
A Correlation ID, also known as a Transit ID, is a unique identifier value that is attached to
requests and messages that allow reference to a particular transaction or event chain
- Choice router
- Scatter-Gather
- first succesful
Dataweave
when you use map, mapObject, filter etc, group by, order by...
• map - Iterates over items in an array and outputs the results into a new array.
• mapObject - Iterates over an array and applies an expression that returns matching values.
• groupby - Returns an object that groups items from an array based on specified criteria, such
as an expression or matching selector.
• Reorders the elements of an input using criteria that acts on selected elements of that input.
• Splits a string into a string array based on a value that matches part of that string. It filters
out the matching part from the returned array.
Caching is the term for storing reusable responses in order to make subsequent requests
faster.
Mule provides the Mule 4 Object Store connector that retrieves and stores values for up to 30
days.
For each splits splits payload collection and process each of them, the output payload will be
same after for each, stop process if any one element throw error
Batch - Parallel processing for huge records, Interally queue exists and pushed in to each
step,... There are 16 threads in a batch,
Batch Aggregator?
In a Mule 3 Batch Job, you would be using Batch Commit to group records to send over the
outbound connector such as a database, Salesforce, etc. Instead of calling database insert for
each record, you can specify the group size to perform a batch commit.
In Mule 4 Batch job, this has been replaced with the Batch Aggregator component. The
underlying behavior and functionality of Batch Aggregator is the same as Batch Commit.
• Process.
• On Complete
- In Mule 4 we have Repeatable steam that means we can read the stream more than
once and accessc concurrently
Example connectors that support streaming -( File, FTP, Database, http, salesforce)
WebSocket created when the Mule app listens for incoming connections.
How do we externalize the properties for the mule app? what are the environment varibles,
how you secure the propoerties
Have you written yaml file, what is it how will you wirte?
YAML is a human-readable data-serialization language. It is commonly used for configuration
files and in applications where data is being stored or transmitted.
Hybrid: Deploy your apps from the Anypoint Platform Runtime Manager cloud console and
host them on your Mule servers.
Private Cloud: Deploy your apps from your on-premises Runtime Manager instance provided
with Anypoint Platform PCE and host them on your Mule servers.
On-Premises: Deploy your apps from the Anypoint Platform Runtime Manager cloud console
and host them in Anypoint Runtime Fabric.
what is a worker?
Applications on CloudHub are run by one or more instances of Mule, called workers.
What is container ?
A container is a standard unit of software that packages up code and all its dependencies so
the application runs quickly and reliably from one computing environment to another.
what is the API Manager how the policies are applied? name some of the policies...
API Manager is a component of Anypoint Platform for designing, building, managing, and
publishing APIs.
• Go to API Manager > API Administration and select the API instance from the details
window.
• From the left navigation, select Policies > Apply New Policy.
• Detokenization Policy
• OAuth 2.0 access token enforcement using Mule OAuth provider Policy
• IP blacklist Policy
• IP whitelist Policy
• Tokenization Policy
CI-CD
CI is the process of integrating code into a mainline code base.
CD is about the processes that have to happen after code is integrated for app changes to be
delivered to users. Those processes involving testing, staging and deploying code
------
Test - Testing Tests the compiled source code suitable for testing framework.
install - installation This phase installs the package in local/remote maven repository.
mule-maven-plugin
MuleSoft Experience?
How do you solve if there is an issue with API?
WebSocket created when the Mule app listens for incoming connections.
Example connectors that support streaming -( File, FTP, Database, http, salesforce)
A process api should talk REST on "both ends". using HTTP Listener connector