connecting to external_application

17
MuleSoft Integration Workshop Connecting to ExternalApplications Rajarajan Sadhasivam

Upload: rajarajan-sadhasivam

Post on 07-Jan-2017

179 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Connecting to external_application

MuleSoft Integration Workshop Connecting to ExternalApplications

Rajarajan Sadhasivam

Page 2: Connecting to external_application

Agenda Understanding Anypoint Exchange -Anypoint Exchange -Types of Content -Accessing and Navigating Anypoint Exchange -Opening an example from Anypoint Exchange

Connecting to Databases(MySQL) - The Database Connector - Supported Databases - Supported Operations - Example Configuration for MySQL

Connecting to JMS(ActiveMQ) - Java Messaging Services - JMS Messaging model - JMS Backchannel - Message Filters in JMS - Example Configuration for ActiveMQ

Page 3: Connecting to external_application

Anypoint Exchange

Anypoint Exchange is a discovery interface (UI and API) where you can find Anypoint Connectors, Templates, Examples, and API RAML descriptions that help make the adoption of the Anypoint Platform a lot easier and faster for you

Anypoint Exchange provides public official Mulesoft content that you can access using Anypoint Studio or from the MuleSoft website as soon as it is published

We can also publish private content to it through your Anypoint Platform organization that is shared only among the members of your organization.

Page 4: Connecting to external_application

Types of Content

Connectors facilitate easy integration of your Mule applications with third-party APIs and standard integration protocols. Use them within your application’s flows to send and receive data via a protocol or specific API. Anypoint Studio comes bundled with a large set of connectors, but in the Exchange are many more.

APIs are RAML files that describe an API’s structure, they can be referenced by an HTTP Request Connector to expose metadata to Studio.

Examples are Mule projects that explain what the elements are in Studio and how they work together to achieve certain objectives.

Templates are projects that cover typical enterprise integration use cases. Find one that performs what you need, provide it user credentials, and it should be good to deploy. You can also customize or extend templates as needed.

Page 5: Connecting to external_application

Accessing and Navigating Anypoint Exchange There are several ways to access the Exchange. From the icon in the Anypoint Studio toolbar, and by By searching for a connector

that you don’t have in your palette

Through Anypoint Studio’s drop-down menu: File > New > Project From Template On the HTTP Request Connector's global element, through the link Search RAML

Exchange Through the Exchange website

Page 6: Connecting to external_application

Opening an example from Anypoint Exchange Below are the basic steps for implementing any of the Examples in Exchange. Find the example that best suits your needs and click View details:

In the XML code are graphic representations of how this implementation looks in Studio, explanatory diagrams etc.

Click Open in Studio to import it into Studio as a new project. The project is then available in your package explorer. Take a look at the files

it contains. The main XML file under src/main/app should automatically be opened in your canvas.

If there are any connectors in the project that require that you provide specific user credentials, enter the connector’s properties editor, and fill in these fields.

Page 7: Connecting to external_application

The Database Connector

The Database connector allows you to connect with almost any Java Database Connectivity (JDBC) relational database using a single interface for every case

The Database connector allows you to run diverse SQL operations on your database, including Select, Insert, Update, Delete, and even Stored Procedures.

The Database connector also allows the use of template queries that are both self sufficient and customizable. You can also perform multiple SQL requests in a single bulk update.

The connector also allows you to perform Data Definition Language (DDL) requests, that alter the data structure rather than the data itself. The Database connector is available with both Mule Community and Mule Enterprise runtimes.

Page 8: Connecting to external_application

Supported Database Engines

The database connector currently includes out of the box support for three database engines:

Oracle

MySQL

Derby

All other database engines – including MS SQL – are supported by the Generic Database Configuration option.

Page 9: Connecting to external_application

Supported OperationsThe database connector supports the following operations:

Select Insert Update Delete Stored Procedure Bulk Execute DDL operations such as CREATE, ALTER, etc.

Additionally, you can run a TRUNCATE query on the database by selecting Update as the operation.

Page 10: Connecting to external_application

MySQL Configuration Name – Use to define a unique identifier for the global database connector

element in your application.

Database Configuration Parameters - Use to define the details needed for your connector to actually connect with your database. When you have completed the configuration, click Test Connection to confirm that you have established a valid, working connection to your database.

Required dependencies - Click Add File to add the database driver to your project.

Page 11: Connecting to external_application

Java Messaging Services (JMS) A Message Oriented Middleware

Supports creation of message based application

Supports Loosely coupled middleware

Supports transactions

Supports reliability

Page 12: Connecting to external_application

JMS Queues

JMS Supports two types of models for messaging

• JMS Queues

Standard Queuing First in First Out (FIFO) Point to Point i.e, Single producer and Single Consumer The Behaviour is similar to VM Queues

Page 13: Connecting to external_application

JMS Topics

JMS Topics

Enables publish and subcribe mechanism The model is similar to RSS Feed Multiple Subcribers can subcribe to a topic Supports publishing a messaging even if subscriber is disconnected using durable

attribute in mule JMS

Page 14: Connecting to external_application

JMS SelectorsJMS Selectors

JMS Selectors are JMS specific filters. They differ from Mule filters in one way. When a Mule filter is used, the message is first de-queued from the JMS queue, and then filtered. If the message does not match the filter, it’s discarded.

With a JMS selector, the filter is applied to the message before it is de-queued, hence if the message does not match the filter, it will not be removed from the queue and discarded, but will remain on the queue to be collected by other clients with a matching JMS selector.

Eg: <jms:inbound-endpoint queue="myQueue">

<jms:selector expression="JMSPriority=9" />

</jms:inbound-endpoint>

Page 15: Connecting to external_application

JMS Backchannels

JMS Backchannels allows responses to be returned in synchronous mule message flow. There are two ways to define backchannel in mule

• - Define your outbound endpoint with request -response exchange pattern.

• - Use a request-reply message processor. Backchannel allows JMS to behave as a two way channel. It Internally sets “reply-to” header that allows mule where to send the response.

Eg : <flow name="RequestReplyFlow"><vm:inbound-endpoint path="RequestReplyRequest"/><request-reply timeout="5000">

<jms:outbound-endpoint path="RequestReplyAsyncRequest"/><jms:inbound-endpoint path="RequestReplyAsyncResponse"/>

</request-reply> </flow >

Page 16: Connecting to external_application

JMS TransformersJMS Transformers

<jms:jmsmessage-object-to-transformer/>

<jms:object-to-jmsmessage-transformer/>

The JMS message to object transformer converts ‘javax.jms.Message’ objects, or sub-types, to generic Java objects.

can change the ‘returnType’ attribute for this transformer to further typecast the result as follows:

javax.jms.TextMessage converts to a java.lang.String. javax.jms.ObjectMessage converts to a java.lang.Object. javax.jms.BytesMessage – converts to a byte array. If the payload is

compressed, it automatically uncompresses it. javax.jms.MapMessage – converts to a java.util.Map. javax.jms.StreamMessage – converts to a java.util.Vector of objects from the

Stream.

Page 17: Connecting to external_application

Thank you