Integration Patterns – Publish/Subscribe (Part2)

 

Article originally posted on the Oracle Integration Blog.

In my previous blog post, I explained the integration pattern publish/subscribe, and how easy it is to make use of its power with Oracle Integration Cloud – all without the need to setup a messaging infrastructure.

The previous post covered the required steps to create the connection, the integration and the trigger (using Postman) to publish a message.

This second part will explain step-by-step how to consume those messages.

 

1. Create an Integration.

We will select the Type Subscribe To OIC.

 

Provide a name a description and optionally
associate this integration with a package.
 

Then you need to select a Publisher. These are available as soon as you configure a “Publish to OIC” integration.

 In my instance I have 2 active Publishers. 

Now we need to decide who is the consumer of the message. For this exercise I will simply write the message to a local file on my machine.

In order to do that I need a File Adapter  and a Connectivity
Agent*

Setting up a File Adapter and the required Connectivity Agent is out of the scope for this article – but you can find the required information for the File Adapter here and how to setup the agent here.

In a real scenario we would use an application or technology adapter to propagate that message to the end application/system.

*The Oracle On-Premises Agent i.e Connectivity Agent is required for Oracle Integration Cloud to communicate to on-premise applications. 

 

 

On the right-side pallet, you need to drag the File Adapter Connection onto the canvas. Once you do that, you get the below wizard.

“what do you want to call your endpoint”: Here we can give a name for the File Operation

 Do you want to specify the structure for the contents file?” – Yes

“Which one of the following choices would be used to describe
the structure of the file content?”
– Sample JSON document.

Now, we need to specify where to write the file and the pattern for the name.

Specify an Output Directory: In this example I use a directory on my local machine

File Name Pattern: The name of the file should be concatenated with %SEQ% which is an incremental variable that is used to avoid files having the same name.

Hoovering with the mouse on the question mark provides more information on this. 

 

The last step is the definition of the file structure. Since we selected a JSON format, I uploaded a very simple sample as seen below. 

This is the end flow with both source and target endpoints configure. We just need to do some mapping now!

By clicking in the Create Map icon we get the below screen, where we can simply drag the attribute message from source onto target.

 

2. Activate the Integration

We are now ready to activate the Integration. You can choose to enable tracing and payload for debugging. You can create more subscribers – I cloned the existing one and named it SubscribeMessage_App2, so that we have two consumers for the published message. 

 

 3. Run the Integration

Now we can use Postman to trigger the publish message – exactly the same as step 4 from post.

 4. Monitor the Results

When we check the Tracking option under Monitoring, we can see the PublishMessage instance and two SubscribeMessage instances – as expected. 

The final step is to verify that 2 files were created in my local machine.

Simple, yet powerful. For more information on Oracle Integration Cloud please check https://www.oracle.com/middleware/application-integration/products.html