0% found this document useful (0 votes)
358 views28 pages

Mule Notes

The document provides answers to various questions about MuleSoft and API development. It discusses Mule versions, components, calling Java code from Mule, validating input, setting timeouts, defining functions, message transformations, exception handling, connecting to mainframe/AS400 systems, testing, logging, version management, security implementation, Anypoint Platform, performance best practices, security policies, policy selection, consuming REST services, circuit breakers, disadvantages of APIs, resilience, load balancing, CloudHub architecture, and setting headers when calling a REST API.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
358 views28 pages

Mule Notes

The document provides answers to various questions about MuleSoft and API development. It discusses Mule versions, components, calling Java code from Mule, validating input, setting timeouts, defining functions, message transformations, exception handling, connecting to mainframe/AS400 systems, testing, logging, version management, security implementation, Anypoint Platform, performance best practices, security policies, policy selection, consuming REST services, circuit breakers, disadvantages of APIs, resilience, load balancing, CloudHub architecture, and setting headers when calling a REST API.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

MuleSof

1. Which Mule Version?

Answer - 3.x.x / 4.x.x

2.Which kind of API? System, Process or Experience API?

3. What are the methods?

5.Components worked on

6.How to call Java code from Mule?

Answer - Using Java Invoke Component

7.How to validate the Input? How to check null response

8.How to set tmeout?

9.How to defne Functons?

10.Message transformatonn/WW, Router, Service Consumer,

11.RAMW Structure

Can we include the schema flee

Answer - Yes we can include schema fle in raml

12.Naming conventon

13./iffence in Mule 3 and 4

Excepton related changes

Answer - htps://doone.com/artcles/error-handling-in-mule-4

14.Types of variables

Record Variable.

Flow Variable.

Session Variable.

15.What are various types of Excepton Handling?

Choice Excepton Handling.


Catch Excepton Handling.

Rollback Excepton Handling.

Global Excepton Handling.

Default Excepton Handling.

16.How to connect with Mainframe or AS400 Systems

- For AS400 : htps://blogs.mulesof.com/dev/connectvity-dev/how-to-build-an-ibm-i-as400-


api-in-15-minutes/

17.Unit Testng, Integraton Testng, Automaton Testng

19.Wogging, Splunk

21.Version Management of API

- Using GIT, SVN


22.How did you implement API Security?

Client ID - Using Client id Enforcement Policy

Token - Using Oauth2.0

24.What is the MuleSoft Anypoint platorm and How did you use it?

26.Performance Best Practces

-Try to use fow references over VM endpoints.

-Try to use connecton pooling for the connectors.

-Use Dataweave for transformatons.

-Try to avoid session variables usage in applicatons. Session variables are serialioed and
deserialioed, which negatvely impacts performance.

27.Which Security Policies

a. Add/Remove Headers

Injects or removes HTTP headers from a request or response.

b. Client ID Enforcement

Enforces the requirement for calls to the API must include a valid client ID and client secret. See
footnote.
c.Cross-Origin Resource Sharing

Allows JavaScript XMLHtpRequest (XHR) calls executed in a web page to interact with resources
from non-origin domains. CORS is a commonly implemented soluton to the "same-origin policy"
that is enforced by all browsers. This policy enables all origins, and makes all resources of an API
public.

d. HTTP Basic Authentcaton Policy

Enforces authentcaton per the details confgured in a Security Manager policy.

e.IP Blacklist

Denies API calls from a defned set of IP addresses.

f.IP Whitelist

Limits API calls to a defned set of IP addresses.

g.JSON Threat Protecton

Protects the target API against malicious JSON that could cause problems.

h.LDAP Security Manager

Injects an LDAP-based security manager into the target API.

i.OAuth 2.0 Access Token Enforcement Using External Provider Policy

Confgures the API so that its endpoints require a mandatory and valid OAuth 2.0 token. You
must reference an external Mule applicaton that serves as the OAuth provider. Update the
RAML of your API using the provided snippet before using this policy.

j.OpenAM Access Token Enforcement

Confgures the API so that its endpoints require a mandatory and valid OpenAM token. This
policy is only available to organioatons using an OpenAM Federated Identty Management
system.

k.OpenID Connect OAuth 2.0 Token Enforcement

Confgures the API so that its endpoints require a mandatory and valid token. This policy is only
available to organioatons using an OpenID Connect Management system.

l.Rate Limitng – SLA-Based

Limits the number of messages per tme period processed by an API at a maximum value
specifed in the SLA ter. Any messages beyond the maximum are rejected. Enforcement is based
on the client ID passed in the request. See footnote.

m.Rate Limitng

Limits the number of messages processed by an API per tme period at a maximum value
specifed in the policy. The rate limitng is applied to all API calls, regardless of the source. Any
messages beyond the maximum are rejected.

n.Simple Security Manager

Supports a placeholder security manager that can be confgured with a hard-coded username
and password for demonstraton purposes.

o.Throtling - SLA-Based

Throtles he number of messages per tme period processed by an API at a maximum value
specifed in the SLA ter. Any messages beyond the maximum are queued for later processing.
Enforcement is based on the client ID passed in the request. See footnote.

p.Throtling

Throtles the number of messages processed by an API per tme period at a maximum value
specifed in the policy. The throtling is applied to all API calls, regardless of the source. Any
messages beyond the maximum are queued for later processing.

q.XML Threat Protecton

Protects the target API against malicious XML that could cause problems.

Note: Update the RAML of your API using the provided snippet before using this policy.

28.How to choose Policy'

A policy extends the functonality of an API and enforces certain capabilites such as security. A
policy can control access and trafc. For example, a policy can generally control authentcaton,
access, alloted consumpton, and service level access (SLA). You can apply policies to these
types of APIs:

An APIkit project

For example, deploy the APIkit project to Anypoint Platorm using API Autodiscovery and apply a
policy.

An API running on CloudHub

Design an API on Anypoint Platorm, confgure a proxy for Cloudhub, and apply a policy.

An API deployed to a private or cloud-based Mule Runtme 3.8.x or later


An API deployed to API Gateway Runtme 2.x

API Manager provides a number of policies. You can also build custom policies. You deploy a
proxy API applicaton and apply one or more policies to control how and when a received
request is forwarded to its implementaton endpoint. You can set an API alert to notfy you when
an API request violates a policy for SLA.

By default, a policy applies to the entre API, fltering trafc requests to every resource and
method.

30.How to consume Rest ServicenHTTP Connector details

can use the HTTP Request connector to consume RESTful web services. You need to specify host,
port, and optonally a host path for connector confguraton. For Endpoint, you need to specify
path and method.

33.How to implement Curcuit Breaker in Mule

- htps://doone.com/artcles/circuit-breaker-module

36./isadvantages of APIs

38.How to take care of resilience

htp://workshop.tools.mulesof.com/modules/modulee

39.How to do load balancing

CloudHub provides a back-end load-balancing service that automatcally provisions


infrastructure components.

CloudHub provides two types of load balancers:

a)Shared Load Balancer

Provides basic load balancing functonality.

CloudHub provides a default shared load balancer that is available in all environments. The
shared load balancer provides basic functonality, such as TCP load balancing. Shared load
balancers don’t allow you to confgure custom SSL certfcates or proxy rules.

Additonally, shared load balancers have lower rate limits that help ensure platorm stability.
MuleSof regularly monitors and scales these limits as necessary. Rate limits on shared load
balancers are applied according to region. If you are deploying an applicaton to workers in
multple regions, the rate limit for each region might be diferent.
If an applicaton exceeds the rate limit for a shared load balancer, the load balancer returns a
503 Service Unavailable response.

To perform custom load balancer confguraton or have higher rate limit thresholds, you must
use a dedicated load balancer.

The shared load balancer supports TLS versions 1.1 and TLS 1.2.

b)Dedicated Load Balancer

Enables you to deploy and confgure one or more custom load balancers within an Anypoint
Virtual Private Cloud (Anypoint VPC).

Dedicated load balancers enable you to:

Handle load balancing among the diferent CloudHub workers that run your applicaton.

Defne SSL confguratons to provide custom certfcates and optonally enforce two-way SSL
client authentcaton.

Confgure proxy rules that map your applicatons to custom domains.

This enables you to host your applicatons under a single domain.

Dedicated load balancers are an optonal component of Anypoint Platorm.

for details : htps://docs.mulesof.com/runtme-manager/cloudhub-dedicated-load-balancer

40.What is CloudHUB

CloudHub is an Integraton Platorm as a Service (iPaaS). It enables you to deploy and run the
applicaton in the cloud via Runtme Manager. CloudHub is a scalable, mult-tenant, elastc,
secure, and highly available iPaas. CloudHub is managed via the Runtme Manager console in the
Anypoint platorm

MuleSof CloudHub Architecture

Runtme Management Console:The Runtme Management console is very well integrated with
Anypoint platorm. You can use your Anypoint credentals to deploy, upload,or manage your
Mule applicatons. You can deploy and manage your Mule applicaton through this same console.
This is also useful for monitoring the platorm services.

Platorm Services:CloudHub shared the set of platorm services and API includes CloudHub
Insights, Alertng, , logging, account management, virtual private cloud/secure data gateway,
load balancing, and others.
CloudHub Worker:Applicatons on CloudHub are run by one or more instances of Mule, called
workers. Below is a list of some characteristcs.

Capacity: Each worker has a specifc amount of capacity to process data. You can select the sioe
of your workers when confguring an applicaton.

Isolaton: Each worker runs in a separate container from every other applicaton.

Manageability: Each worker is deployed and monitored independently.

Locality: Each worker runs in a specifc worker cloud, the US, EU, Asia-Pacifc, etc

CloudHub is designed in such way that it can provide various features like high availability,
scalability, intelligent healing, and oero downtme. Mule applicatons deployed in CloudHub can
be easily scalable without any downtme

41.How to set Headers when you call a Rest Service

htps://stackoverfow.com/questons/2947008701/mule-set-htp-header-values-from-postman-
rest-clienterq=1

42.How to encrypt propertes in Mule?

Mule Credentals Vault can be used to encrypt customer data in a .propertes fle. The .propertes
fle is used by developers to set up the propertes for diferent environments (dev, stage, lt, prod)
as a one-tme actvity. Mule applicatons use the data from the propertes fle during runtme,
e.g. credentals for a secured database, credit card informaton for a customer, social security
numbers, etc.

Anypoint Enterprise Security is a collecton of security features that enforce secure access to
informaton in Mule applicatons. This helps in applying security to Mule Service-Oriented
Architecture (SOA) implementatons and Web services.

Anypoint Enterprise Security suite helps applicaton developers to develop security solutons as
per security requirements, prevent security breaches and facilitate authorioed access to data.

43.What is VM

Allows sending messages inside the JVM in which Mule is running.

Messages sent to VM endpoints can be made transactonal and persisted to the disk.

Can be used to implement reliability and decouple fows without the need for an external
messaging broker

44./ifference between VM and Sub Flow

45.TrustStore and KeyStore


Keystore — In short, Keystore is a server-side asset that stores the private keys and the
certfcates with their public and private keys.

Truststore — Truststore is a client-side asset that serves as a repository of certfcates (CA or


simple) that the client should trust.

trustStore is used by TrustManager and keyStore is used by KeyManager class in Java.

we use -Djavax.net.ssl.keyStore to specify path for keyStore and -Djavax.net.ssl.trustStore to


specify path for trustStore in Java.

password of keyStore is provided using -Djavax.net.ssl.keyStorePassword and password of


trustStore is provided using -Djavax.net.ssl.trustStorePassword.

46.What is Mule /omain Project

We can make connectors as an reusable component by defning them as common resources and
expose them to all applicatons deployed under a same domain, these resources are known as
shared resources. These shared resource needs to be defned inside Mule Domain Project and
then referred to each of the projects that are meant to use the elements in it.

47.What the standards you follow while developing APIs

htps://mulesoftrainings.wordpress.com/201e/05/2e/42/

48.Which RAMW standards are followed?

- RAML 0.8 or RAML 1.0 Standards

htps://github.com/raml-org/raml-spec/wiki/Breaking-Changes

49.Any scenario where you discouraged API?

50.VM Connector - VM Arguments

- name

- Exchange Patern (One-way/request-response)

-Queue path

- Connector Confguraton

51.Flow processing strategies - hands on

Blocking - Non blocking -

Sync Vs async
Async - How fow will work

Batch Jobs -

Excepton Strategies

How to maintain Data integrity

Performance - How to tune the API

How to manage Thread Profles

-------------------------------------------------------------------------------------------------------

1.What is API Wed Connectvity?

- This approach is based on Pace layers. The main purpose of API-led connectvity is to enable
the integraton fows to be reused by many partes and to be reused inside the integraton
platorm. With the reusability of the already available logic (implemented in fows), the
developers can evolve their logic in faster and safer ways, leading to a short tme to market. APIs
are created in layers and the best plus point as compared to E2E approach is that more
components (fows) can be reused which makes easier to implement new systems and services.

In this approach, the APIs are based on three distnct layers: System, Process, and Experience.

System Layer - This is the foundatonal layer of the three-layer architecture. These APIs can be
defned for various domains of an organioaton, for example, ERP, key customer and billing
systems, proprietary databases, etc. System APIs provide a means of accessing these underlying
systems of records and exposing the data in canonical formats. A System API defnes the contract
RAML/WSDL to describe how to interact with the domain. For example, a System API for a
customer domain can contain resources with methods like GET, POST, PUT, and DELETE, and the
related schemas (XSD, JSON) and responses (200, 400, 500, etc).

One can modify the System API logic without afectng the other APIs (Process and Experience).
For example, if a System API is using SAP and, in the future, SAP needs to be replaced with
Salesforce, this replacement can be done easily modifying only the System API without touching
anything in Process and Experience layers.

Process Layer-Process layer APIs are responsible for shaping the data by orchestratng and
choreographing various data by calling multple System APIs. The orchestraton involves the
aggregatng, splitng, and routng 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.

For example, in a purchase order process, it needs to interact with various domains of the
organioaton. The Process API (purchase order/order fulfllment) interacts with the already
available System APIs to implement the logic.

The Process APIs should be held privately inside the organioaton as per recommendaton and
should not be exposed for public use.

Common business logic can be shared across the organioaton. For example, if an organioaton
already has the purchase order process API implemented, it can be reused whenever necessary.

Experience Layer-At this point, we have all the sensitve informaton of an organioaton exposed
privately by System APIs, and the Process APIs have already exposed the business process logic.
The business process data is consumed across a broad range of clients/channels with diferent
formats. For example, our Order Purchase API (Process Layer) has exposed data in the JSON
format, but we have a client applicaton that accepts only XML format, or vice versa. This simple
transformaton logic is implemented in the Experience Layer and the implementatons are
exposed as Experience APIs.

In other words, Experience APIs are the means by which data can be reconfgured easily to meet
the needs of multple audiences. Also, we can remove the unnecessary methods and expose
only the necessary methods in Experience APIs in a simple way.

The Experience APIs are the ones which should be exposed publicly for consumpton. In short,
they are the fnal products of an organioaton in the API-led connectvity approach. Various
policies can be applied to the APIs as well, as they can be monetoed to earn revenue for the
organioaton.

Experience APIs are simple. Basically, they involve only the transformaton of data. So, to meet a
wide range of clients that accept data in diverse formats, the Experience APIs do this rapidly,
decreasing the tme to market

2.What are the different types of fow processing strategies?

a) Synchronous Flow Processing Strategy : Mule processes messages in a single thread.

b) Queued-Asynchronous Flow Processing Strategy : Mule uses a queue to decouple the receiver
thread from the rest of the fow.

c) Asynchronous-processing-strategy : Not applicable to most use cases. Same as queued-


asynchronous processing strategy except that it doesn’t use a queue. Use this only if for some
reason you do not want your processing to be distributed across nodes.

d)Queued-thread-per-processor-processing-strategy: Not applicable to most use cases. Writes


messages to a queue, then every processor in the scope runs sequentally in a diferent thread.

e) Thread-per-processor-processing-strategy: Not applicable to most use cases. Every processor


in the scope runs sequentally in a diferent thread.
f) Non-Blocking Processing Strategy: The non-blocking processing strategy in contrast uses an
evented non-blocking processing model to process requests. In this model a single thread stll
handles each incoming request, but non-blocking components return this thread to the listener
thread pool. Only upon obtaining and using a new thread, can processing contnue

Mule selects a processing strategy for a fow based on two criteria:

a) The fow’s exchange patern: request/response & one way processing

b) Whether or not the fow is transactonal:

3.Explain Queued asynchronous fow processing strategy?

The queued-asynchronous approach uses a queue to decouple the fow’s receiver from the rest
of the steps in the fow

This means that once the receiver places a message into a queue, it can immediately return and
accept a new incoming message. Furthermore, each message waitng in the queue can be
assigned a diferent thread from a pool of threads. A component called a Work Manager assigns
pending messages to available threads, so they can be processed in parallel. Such parallel
processing is ideal for situatons where the receiver can, at peak tmes, accept messages
signifcantly faster than the rest of the fow can process those messages.

However, the increased throughput facilitated by the asynchronous approach comes at the cost
of transactonal reliability.

4.What are the different types of excepton strategies?

Mule has fve diferent Messaging Excepton strategies:

a) Default Excepton Strategy

This strategy is applied to Mule fows implicitly and it can handle all exceptons in your fows. It
can be overridden by adding a Catch, Choice, or Rollback excepton strategy to the fow. Mule
applies this strategy automatcally and rolls back any pending transactons and logs the
excepton. If there is no transacton, it will stll log the excepton.

The default excepton strategy can be used when you don’t want to take any specifc actons in
case of exceptons.

Mule’s default excepton strategy automatcally actvates when any error occurs in any of your
fows. It cannot be confgured in Anypoint.
When a message throws an excepton, the default excepton strategy rolls back the message and
logs the excepton.

b) Rollback Excepton Strategy

This strategy should be used when it is not possible to correct the error that occurs in a fow. It
can be used in transactonal fows to handle errors. If an excepton is thrown while processing a
message, this strategy rolls back the transacton and Mule delivers the message to the inbound
connector of parent fow to reprocess the message.

In additon to managing transactonal errors, the rollback excepton strategy can be used to
Manage exceptons that applicatons cannot catch.

Use in fows where a message should be redelivered in case of failure.

A rollback excepton strategy can introduce an infnite loop of actvity within a foww a message
throws an error, the rollback excepton strategy catches the excepton and redelivers the
message back for reprocessing. The message throws an error again, the rollback excepton
strategy catches the excepton again, again does the redelivery, and so on.

To avoid this infnite loop and responsibly manage unresolvable errors, you can apply two
limitatons to a rollback excepton strategy:

Defne the maximum number of tmes redelivery of a message should happen.

Defne another fow to handle messages that are failing afer the maximum number of redelivery
atempts.

The rollback excepton strategy provides multple atempts for a message to successfully move
through a fow before commitng a failed transacton and consuming the message.

c) Catch Excepton Strategy

This strategy catches all exceptons thrown within its parent fow and processes them, thereby
overriding Mule’s implicit default excepton strategy. Mule’s catch behavior is similar to a Java
catch block, except that you cannot throw a new excepton or catch another excepton within a
catch excepton strategy.

Avoid propagatng exceptons to inbound connectors.

Avoid propagatng exceptons to parent fows via Flow Reference Components.

Ensure that a transacton processed by the fow is not rolled back when an error occurs.

When a message throws an excepton, the catch excepton strategy always commits the
transacton and consumes the message.
d) Choice Excepton Strategy

This excepton strategy is useful when you want to handle the excepton based on the message
content afer an excepton is thrown. It catches all exceptons thrown within its parent fow,
checks the message content and excepton type, and then routes the message to the
appropriate excepton strategy.

There is more than one excepton strategy which is defned within this strategy. Catch or
Rollback uses MEL to advise the Choice excepton strategy as to which message it accepts and
will be doing further processing. If none of the Choice excepton strategies are able to handle the
error, it routes the message to the default excepton strategy.

A Choice excepton strategy contains one or more catch or rollback excepton strategies.

A Choice excepton strategy cannot be nested within other choice excepton strategies.

Any Mule expression evaluator can be used as the expression atribute of an excepton strategy.

Remember that a choice excepton strategy checks the expression atribute of each of its
excepton strategies one by one, serially, to see which one should handle the errorw it then
routes the message to the frst excepton strategy that evaluates to true. Arrange your excepton
strategies as the top-most evaluates frst, then the one below it, and so on.

The choice excepton strategy never actually performs any rollback, commit, or consume
actvites.

e) Reference Excepton Strategy

This is to refer to a common excepton strategy which you can defne in a separate confguraton
fle. You can create one or more global excepton strategies to reuse in fows throughout your
entre Mule applicaton.

For this, add a Reference Excepton Strategy to a fow to refer the error handling the behavior of
a specifc global excepton strategy.

When a message throws an excepton, the reference excepton strategy refers to the error
handling parameters defned in a global catch, rollback, or choice excepton strategy.

The reference excepton strategy itself never actually performs any rollback, commit, or consume
actvites.

6.How will you use MEW in catch excepton strategies?

#[excepton.causedBy(org.mule.example.ExceptonType)]
#[excepton.causedExactlyBy(org.mule.example.ExceptonType)]

#[excepton.causeMatches('org.mule.example.*')]

#[excepton.causeMatches('*') &&

!excepton.causedBy(java.lang.ArithmetcExcepton) &&

!excepton.causedBy(org.mule.api.registry.ResolverExcepton)]

7.What is scatter-gatter?

- Scater-Gather is a routng message processor in Mule ESB runtme that sends a request
message to multple targets concurrently. It then collects the responses from all routes and
aggregates them back into a single response.

Once a message is received by Scater-Gather, it sends a message for concurrent processing to all
confgured routes. The main thread executng the fow that owns the router waits untl all routes
complete or tme out.

If there are no failures, Mule aggregates the results from each of the routes into a message
collecton (MessageCollecton class). Failure in one route does not stop Scater-Gather from
sending messages to its other confgured routes, so it is possible that many or all routes may fail
concurrently.

8.Scenario like if scater-geter send the request simultaneously to multple fows and one of the
fows throws the excepton then how can handle the exceptone

If and when some of the route fails,Scater-Gather performs the below operatons:

Sets the excepton payload accordingly for each route.

Throws a CompositeRoutngExcepton, which maps each excepton to its corresponding route


using a sequental route ID.

9.Message Enricher?

Mule Message Enricher is one of the scopes in Mule which allows the current message to be
augmented using data from a separate resource, which we call the Enrichment Resource. The
Mule implementaton of the Enrichment Resource (a source of data to augment the current
message) can be any message processor.

In simple language, we can say a message enricher enriches the current payload with some
additonal message or informaton and this is done without disturbing the current payload.

Enricher is used if the target system needs more informaton than the source system can
provide. It enriches the Mule message by calling an external system or doing some
transformaton to the existng payload and saving it into some scope of variable, like session,
outbound, or invocaton, and the transformaton happening in the enricher scope doesn't afect
the actual payload. Set-property: Save some informaton extracted from payload or original
payload to some invocaton or fow scope variable.

10.Cache scope?

The Cache Scope is a Mule feature for storing and reusing frequently called data. The Cache
Scope saves tme and processing load.

11.Explainm different types of cache scopes?

Mule provides the below storage strategies during Cache Implementaton:

a)In-memory-store: data is stored in Local Mule Runtme Memory and it is non-persistent which
means data would be lost if an event of restart or shutdown the mule applicaton.

Confguraton required:

Store name

Maximum number of entries (that is, cached responses)

The “lifespan” of a cached response within the object store (i.e. tme to live)

The expiraton interval between polls for expired cached responses

b)Managed-store: data cached will be stored in a place defned by ListableObjectStore inside


Mule, a persistent storing mechanism where in the event of any shutdown or restart of the Mule
applicaton, the data would stll be intact.

Confguraton required:

Store name

Persistence of cached responses (true/false)

Maximum number of entries (i.e. cached responses)

The “lifespan” of a cached response within the object store (i.e. tme to live)

The expiraton interval between polls for expired cached responses

c)Simple-test-fle-store: As the name denotes, data in this approach is stored as a flew also a
persistent storing mechanism where in the event of any shutdown or restart of the Mule
applicaton, the data would stll be intact.
Confguraton required:

Store name

Maximum number of entries (i.e. cached responses)

The “lifespan” of a cached response within the object store (i.e. tme to live)

The expiraton interval between polls for expired cached responses

The name and locaton of the fle in which the object store saves cached responses

13.What are the components you have used in last project?

14.what is the use of /ataWeave?

The Transform Message component in Anypoint Studio gives you the tools to leverage the
DataWeave language, allowing you to map and connect to anything, regardless of data type or
structure.

This DataWeave Quickstart Guide introduces the key functonal features of the Transform
Message component and DataWeave:

Type Transformaton

Graphical UI for Data Mapping

Sample-based Output Preview

Navigatng I/O Mapping

Filter and groupBy Operators

htps://docs.mulesof.com/mule-runtme/3.9/dataweave-quickstart

15.write a program for if the payload is an array in dwl fle.

- Using Map Operator

Under Transform Component

%dw 1.0

%output applicaton/json

---

users: ["john", "peter", "mat"] map upper $

Output
{

"users": [

"JOHN",

"PETER",

"MATT"

for details htps://docs.mulesof.com/mule-runtme/3.9/dataweave-operators

16.Where your api is deployed?

- On-Premise/Cloud/Hybrid

17.Explain RAMW structue clearly?

RAML:(RESTful API Modeling Language)

RAML is similar to WSDL, it contains endpoint URL, request/response schema, HTTP methods
and query and URI parameter.

RAML helps client (a consumer of the service) know, what the service is and what/how all
operatons can be invoked.

RAML helps the developer in creatng the inital structure of this API. RAML can also be used for
documentaton purpose.

ResourceTypes:

ResourceTypes is like resource in that it can specify the descriptons, methods, and its
parameters. Resource that uses resourceTypes can inherit its nodes. ResourceTypes can use and
inherit from other resourceTypes.

ResourceType is basically a template that is used to defne the descriptons, methods, and
parameters that can be used by multple resources without writng the duplicate code or
repeatng code.

Traits:

Traits is like functon and is used to defne common atributes for HTTP method (GET, PUT, POST,
PATCH, DELETE, etc) such as whether or not they are flterable, searchable, or pageable.

Traits can be declared in the same RAML fle or you can create diferent fles for creatng the
traits.

Traits can be called by resources using the "is" keyword.

Traits can be called from ResourceTypes using the "is" keyword only.

in RAML URI paramter is defned by /{employeeID}:

In RAML 0.8, the default value for a required atribute is false

In RAML 1.0, the default value for a required atribute is true

RAML 0.8 repeat on named parameters,removed in 1.0 version.

Also

Data types: a unifed, streamlined, and powerful way to model data wherever it appears in an
API.

Uniformly covers bodies, URI parameters, headers, and query parameters and eliminates the
need for a separate formParameters construct

Supports wrapping XML Schema and JSON Schema and even referring to sub-schemas, but in
many cases just obviates the schemas

Simplifes coding, compared to the JSON Schema or XML Schema, by virtue of being YAML-based

Examples: multple examples, expressible in YAML, and annotatable, so semantcs can be


injected

Annotatons: a tried-and-tested, strongly-typed mechanism for extensibility

Libraries: improved modularity for broad reuse of API artfacts

Overlays and Extensions: increased extensibility through separated fles

Improved Security Schemes:

Wider OAuth support

Support for pass-through (key-based) security schemes

Several smaller changes for consistency and expressivity

In RAML 1.0, the date type has been replaced by a set of more specialised types such as date-
only (yyyy-mm-dd), tme-only (hh:mm:ss[.f...]), datetme-only (yyyy-mm-ddThh:mm:ss[.f...]),
and datetme

In RAML 0.8 it was valid to defne baseUriParameters also on non root-level nodes such as
resources. RAML 1.0 removes that ability and supports the declaraton of any base URI
parameters only at the root-level of your API defniton

htps://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md/

18.How do you use Rollback excepton strategies?

- You can defne a rollback excepton strategy to ensure that a message that throws an excepton
in a fow is rolled back for reprocessing. Use a rollback excepton strategy when you cannot
correct an error that occurs in a fow. Usually, you use a rollback excepton strategy to handle
errors that occur in a fow that involve a transacton. If the transacton fails, that is, if a message
throws an excepton while being processed, then the rollback excepton strategy rolls back the
transacton in the fow. If the inbound connector is transactonal, Mule delivers the message to
the inbound connector of the parent fow again to reatempt processing (that is, message
redelivery).

19.is Catch excepton strategies will use message? and how it will use message?

- Yes. By using excepton payload.

20./ifferent types of Thread Pools?

Receiving - Message source's threads.

Flow processing - Message processor's threads.

Dispatching - Outbound endpoint's threads.

21.Scenario like if the request contains Username then it is going to hit your fow suppose your
passed username is invalid and you have to catch that excepton and display like invalid
username How do you do it?

- Throw Excepton using Groovy and Catch using Catch Excepton Strategy

22.Which listener you have used for listening the request?

- HTTP/HTTPS

23.How can you confgure Https request listener?

- Provide HTTPS Host and Port

- Provide TLS Confguraton

htps://docs.mulesof.com/mule-runtme/3.9/htp-listener-connector#htps-protocol-
confguraton

24.When an excepton is throwing is it use payload or not?


- It uses payload

25.what are the different types of variables?

- Flow Variable, Session Variable, Record Variable

26.What are the different types of fows and explain it?

Mule Applicatons are composed of fows.Flows are initated by a Message Source

Flows contain message processors.Flows can send messages of to other fows and eventually
external resources

a)Subfow

Does not have an inbound endpoint at the beginning of the fow

Does not have its own thread pool

Callable only by using a fow reference

Cannot have their own error handlingw errors caught in parent fow

b) Private Flow

Does not have an inbound endpoint at the beginning of the fow

Callable only by using a fow reference

Operates on its own thread

Can contain its own error handling

27.Suppose if ArrayWist contains duplicate elements then how can you display only duplicate
elements?

28. Suppose I have employee table contains columns: empno ename age sal

then how many emloyees have same agee

- "language": sizeOf ((payload.employee.*age) filter ($ == "AgeValue"))

---------------------------------------------------------------------------------------------------------------------

1. Explain the Mule message in the context of Mule Flow.What Are /ifferent Type Of Messages
In Mule ?

MULE Message: data moves the Applicaton through fows

Header:contains metdata about message


Inbound propertes:

- Read-only Access

- Set from the Message Source

- Persists throughout the fow

Outbound Propertes:

Read/Write Access

- Added by Property MP

- Ability to:

∙ Write

∙ Delete

∙ Copy

Payload:Business Specifc data.

Contains primary informaton to be processed by Mule

Contains a Java Object

Atachment:

Variable: Name Value pair that represent data about message

Excepton Paylaod: holds any error that occurred during the processing of the event.

Ø Bridge messages: Pass messages from inbound to outbound routers.

Ø Echo and log messages: Log messages and move them from inbound to outbound routers.

Ø Build messages: Create messages from fxed or dynamic values

2. What are inbound and Outbound propertes ?

Inbound propertes are immutable, are automatcally generated by the message source and
cannot be set or manipulated by the user. They contain metadata specifc to the message
source. A message retains its inbound propertes only for the duraton of the foww when a
message passes out of a fow, its inbound propertes do not follow it.

Outbound propertes are mutablew can be set/modifed in a fow and can become inbound
propertes when the message passes from the outbound endpoint of one fow to the inbound
endpoint of a diferent fow via a transport. They contain metadata similar to that of an inbound
property, but an outbound property is applied afer the message enters the fow. Note that if the
message is passed to a new fow via a fow-ref rather than a connector, the outbound propertes
remain outbound propertes rather than being converted to inbound propertes

3. what is the difference between SOAPKit Router and APIKit Router and when to use what?

SOAP Kit Router is used when a SOAP service is to be developed via WSDL. SOAP Kit Router will
read the WSDL confgured, validate the request message coming in (if confgured) and send it to
the appropriate fow for processing based on the operatons been confgured in WSDL.

API Kit Router is used when a REST base service is been created developed via RAML. API Kit
Router will read the RAML confgured, validate the request message coming in (if confgured)
and send it to the appropriate fow for processing based of the HTTP methods in RAML.

4. what is the use of Scatter--ather fow control?

Parallel actvate/fows can be executed in mule by using Scater-Gather fow control component.

The routng message processor Scater-Gather sends a request message to multple targets
concurrently. It collects the responses from all routes, and aggregates them into a single
message.

5. What Is Autodelete & Fileage Property In File Connector In Mule

The default value of autoDelete is true. Therefore, a fle inbound endpoint will, by default,
remove the fle from the source directory once it is read by the inbound endpoint. If you do not
want to delete fle automatcally then you can set autoDelete property to false.

The fleAge property specifes how long the endpoint should wait before reading the fle again.
For instance, a fleAge of e0000 indicates Mule should wait a minute before processing the fle
again

6. What all are the HTTP methods that can be confgured in RAMW?

- GET,POST,PUT,PATCH,HEAD,Optons,DELETE

7. Steps to confgure a dB connector? idnpasswrd encrypt technique used?

8.Updaton/Changes in Mule 4e

htps://blog.vsofconsultng.com/blog/mule-4-vs-mule-3-release-which-is-more-benefcial

9.What are the different catagories of policies and what are the types of APIs where its
applicable?
Policy Category Fulfills Required

Client ID Enforcement Compliance Client ID Required None


CORS Compliance CORS-enabled None
Header Injection Transformation Header Injection None
Header Removal Transformation Header Removal None
Security
HTTP Basic Authentication Security Authentication
Manager
IP Blacklist Security IP Filtered None
IP Whitelist Security IP Filtered None
JSON Threat Protection Security JSON Threat Protected None
LDAP Security Manager Security Security Manager None
Message Logging Troubleshooting Message Logging None
OAuth 2.0 Access Token Enforcement Using
Security OAuth 2.0 protected None
External Provider Policy
OpenAM Access Token Enforcement Security OAuth 2.0 Protected None
PingFederate Access Token Enforcement Security OAuth 2.0 Protected None
Rate Limiting Quality of Service Rate Limited None
Rate Limiting, SLA-Based Quality of Service Rate Limited, Client ID required None
Simple Security Manager Security Security Manager None
Throttled, Rate Limited, Client
Throttling -SLA-Based Quality of Service None
ID required
Throttling Quality of Service Throttled, Rate Limited None
XML Threat Protection Security XML Threat Protected None

12.How to set up different policies it and its proxy service?

13. Http status codes??

200 OK, 201 Created ,202 Accepted, 401 Unauthorioed, 404 NOT Found,405 Method Not
Allowed,400 Bad Request, 502 - Bad Gateway

14. what is API gateway? what mule connectors does API -ateway support ? HTTPnS
,Jetty,File,J/BC,WS-Consumer connectors

An API Gateway is just that — a gateway protectng APIs. Any tme you create an API and make it
publicly available, there are two issues that need to be addressed:Performance and Security

The API Gateway runtme points to the backend APIs and services that you defne and abstracts
them into a layer that Anypoint Platorm manages. Consumer applicatons invoke your services.
APIs route to the endpoints that the gateway exposes to enforce runtme policies and collect and
track analytcs data. The API Gateway acts as a dedicated orchestraton layer for all your backend
APIs to separate orchestraton from implementaton concerns. The gateway leverages the
governance capabilites of the API Manager, so that you can apply throtling, security and other
policies to your APIs.

API Gateways are designed and optmioed to host an API or to open a connecton to an API
deployed to another runtme. The API Gateway runtme performs functons critcal to running
and managing APIs:

Gateways serve as a point of control over APIs, determining which trafc is authorioed to pass
through the API to backend services, to meter the trafc fowing through, to log all transactons
and to apply runtme policies to enforce governance like rate limitng, throtling and caching.

API Gateways integrate with the backend services that power them. An API is just an interface
that calls functonality living in a service or applicaton and unless that functonality lives in a
well-defned web service, integraton and orchestraton capabilites are required to connect it to
the API.

htps://www.mulesof.com/resources/api/secure-api-gateway

15.. How can we deploy Mule API on different environment without changing the code or
confguraton details?

- By Creratng property fles for all Enviornment (DEV,SIT,Prod etc)

16. What are policy in Mule and how to implement custom policy?

MuleSof provides certain built-in policies which can be referred to address general situatons to
flter unwanted trafc coming to your API. However, MuleSof provides the capability to create
custom policies, which are designed primarily to address complex scenarios like SQL injecton.
Custom policies are confguraton fles that defne the behavior of your API for each incoming
request.

To create custom policies, mainly two confguraton fles are required

Mulesof Defniton fle (YAML) - File in which you defne characteristcs of the custom policy.
Characteristcs are defned using:

:name - used to describe policy in API platorm

:descripton - detailed descripton of policy

:category - text used in API platorm to list policies

:standalone - true if policy can work independently, false if it can only be applied as a
sub-part of another.

:confguraton - defnes custom confguraton parameters for your policy.

MuleSof Confguraton fle(XML) - File in which you defne the actual logic/implementaton of
your defned custom policy. There are two main tags:

<before> - Code writen within the <before> tag executes on every incoming request BEFORE
sending it to main API services.

<afer> - The afer tag gets executed afer completon of main API services, i.e afer completon
of the request.

Generally, it happens that we don't have anything to do once the API request is completed. The
<afer> tag will not contain anything, but we can't have <before> and <afer> tags lef empty. In
such scenarios, simply remove the declaraton of the tag to avoid errors.

Similarly, for MuleSof 3.8+, you can create an API custom policy project in Anypoint Studio. It
will automatcally have two fles with extensions .xml and .yaml.

17. How to implement Custom Connectors in Mule ESB?

- htps://docs.mulesof.com/anypoint-connector-devkit/v/3.8/

Annotatons:

@Connector: For java class, for giving name to connector

@processor: java methods

@Confgurable: For data members

18. Calling Java Method from dataweave

i) Create Global Confguraton from Global Elements

ii) Create xml node <expression-language>

iii) Import java class and and Global Functon and provide java method in that

iv) call the same method in dataweave which defned in global functon of Confguraton
mentoned in step iii)

19. Connecton Pooling for /atabase in Mule

Connecton pooling means that connectons are reused rather than created each tme a
connecton is requested. To facilitate connecton reuse, a memory cache of database
connectons, called a connecton pool, is maintained by a connecton pooling module as a layer
on top of any standard JDBC driver product.

Connecton pooling is performed in the background and does not afect how an applicaton is
codedw however, the applicaton must use a DataSource object (an object implementng the
DataSource interface) to obtain a connecton instead of using the DriverManager class. A class
implementng the DataSource interface may or may not provide connecton pooling. A
DataSource object registers with a JNDI naming service. Once a DataSource object is registered,
the applicaton retrieves it from the JNDI naming service in the standard way.
If the DataSource object provides connecton pooling, the lookup returns a connecton from the
pool if one is available. If the DataSource object does not provide connecton pooling or if there
are no available connectons in the pool, the lookup creates a new connecton. The applicaton
benefts from connecton reuse without requiring any code changes. Reused connectons from
the pool behave the same way as newly created physical connectons. The applicaton makes a
connecton to the database and data access works in the usual way. When the applicaton has
fnished its work with the connecton, the applicaton explicitly closes the connecton.

------------------------------------------------------------------------------------------------------------------

MuleSof Questons

================

Q.Why you used Mulesoft ?

Mule is lightweight but highly scalable, allowing you to start small and connect more
applicatons over tme. The ESB manages all the interactons between applicatons and
components transparently, regardless of whether they exist in the same virtual machine or over
the Internet, and regardless of the underlying transport protocol used.

Several commercial ESB implementaton provide limited functonality or built on top of an


existng applicaton server or messaging server, locking you into that specifc vendor. Mule is
vendor-neutral, so diferent vendor implementatons can plug in to it. You are never locked in to

Q.What tyoe of API you developed ?

Q.What is RAMW ?

RAML – RESTful API Modeling Language

RAML is similar to WSDL, it contains endpoint URL, request/response schema, HTTP methods
and query and URI parameter.

RAML helps client (a consumer of the service) know, what the service is and what/how all
operatons can be invoked.

RAML helps the developer in creatng the inital structure of this API. RAML can also be used for
documentaton purpose.

Q.where you deploy and publish the API ?

- Deploy in Runtme Manger and Publish in Anypoint Exchange of Anypoint platorm

Q.How and where verify the RAMW ?


Q.how you generate RAMW ?

- Design RAML in Design Center

Q.If you don't have Anypoint Studio and Anypoint platorm available then how you create
RAMW ?

- By using apiworkbench or using text editor like notepad , wordpad etc..

Q.What are beans scope ?

Q.how we can instantate the beans ?

https:nndocs.mulesoft.comnmule-runtmen3.9nusing-spring-beans-as-fow-components

Q.how bean's single instance create if scope in not singleton ?

Q.How and where verify the RAMW ?

- User can verify raml in design center or while uploading RAML in Anypoint Studio

Q.What is API ?

API is the acronym for Applicaton Programming Interface, which is a sofware intermediary that
allows two applicatons to talk to each other.

where you deploy and publish the API e

- User can publish API in exchange and Deploy in Runtme Manger of Anypoint Platorm.

Q.What is CBIW scope and how you developed API ?

Q.REST vs SOAP ?

ü SOAP is a protocol. -> REST is an architectural style.

ü SOAP stands for Simple Object Access Protocol. -> REST stands for REpresentatonal State
Transfer.

ü SOAP can’t use REST because it is a protocol. -> REST can use SOAP web services because it is
a concept and can use any protocol like HTTP, SOAP.

ü SOAP uses services interfaces to expose the business logic. -> REST uses URI to expose
business logic.

ü SOAP defnes standards to be strictly followed. -> REST does not defne too much standards
like SOAP.

ü SOAP defnes standards to be strictly followed. -> REST does not defne too much standards
like SOAP.

ü SOAP requires more bandwidth and resource than REST. -> REST requires less bandwidth and
resource than SOAP.

ü SOAP defnes its own security. -> RESTful web services inherit security measures from the
underlying transport.

ü SOAP permits XML data format only. -> REST permits diferent data format such as Plain text,
HTML, XML, JSON etc.

ü SOAP is less preferred than REST. -> REST more preferred than SOAP.

You might also like