Advertisements



SOA 12c – Durable Subscribers with Weblogic JMS

Business Events are used to notify the interested parties (subscribers) about an occurrence of activity which is of important to them. On raising the business events, the subscribers would consume them and process it based on their business flows. All these things would happen in a highly loose coupled manner and business events producers may not be aware of the subscribers. So when designing an application based on business events one of the aspects requires attention is, Will there be any loss of event? This is very important as subscribers are not in a position to request providers to raise event again, even if they do its going to be a duplicate event (occurrence) for other subscribers. Technically speaking, the loss of event can be translated into any of these following scenarios:

  • Subscriber received the business event but faulted during processing.
  • Subscriber is unavailable when the business event is published.
  • The hosted server itself is down when the business event is published.

Scenario 1: For this scenario, EDN provides different Consistency levels and Auto Retry feature which you can use. The post discusses this behavior and also highlights major differences between 11g and 12c SOA Suite releases. In other cases where this feature can’t be leveraged, developer had to take care of manually storing event information and retrieving later on processing failure.

Scenario 2: Typically this scenario may not arise in production environments but there is a possibility when event producer and subscribers are deployed on different managed servers and maintenance cycles for both are different. EDN 11g does not support for this case and it mandates Subscribers to be available when event is published. But in 12c, this scenario is handled using Durable Subscribers which we see shortly.

Scenario 3: This scenario also automatically handled by EDN as it queues the events. And once the server is up, the events in queue will get delivered to their respective subscribers.

In this post, we will see how Durable property works for Business Events. We will use the same 3 composites used in previous post, where we have 3 subscribers for CreateOrder and 1 subscriber for UpdateOrder business events respectively. From here onwards, we will use subscribers or composites terminology interchangeably.

  • Deployment of composites with Durable property to Yes.
  • Any of the Composites subscribed to business events are shutdown.
  • Redeployment of composites with same revision.
  • Redeployment of composites with different default revision.
  • Server shutdown and restart when a few business events are pending to be delivered.
  • Un-deployment of the composites.
  • Redeployment of composites after modifying Durable property to No.

So let’s us get started!!!

To start with let’s have a quick look at Events and Subscriptions used for demonstration. To view these navigate to soa-infra->Business Events.

 

Durable property to Yes:

Set Durable property to Yes for all subscribers and do deploy.

When Durable property is set to Yes, EDN leverages Weblogic JMS durable subscriptions and creates Durable subscribers for each such subscription. Durable subscriptions mean that Weblogic server will store the messages in persistent store until it gets delivered to subscriber. This can be observed in Weblogic Admin Console by navigating to Services->Messaging->JMS Modules->SOAJMSModule->EDNTopic->Monitoring->Durable Subscribers.

You can observe 4 Durable subscribers in the above screen where 3 of them for CreateOrder and 1 for UpdateOrder business events respectively. You can find out JNDI of JMS Topic used for an event in default JMS Mapping by navigating to Business Events screen from soa-infra and you can also modify this default JMS Mapping for business events.

Subscribers Down:

Shutdown EDNSubscribeSync composite and observe durable subscribers.

In above screenshot, you can observe that corresponding durable subscriber is inactive (observe value for Active column).

Now raise CreateOrder business event. Go to flow trace and observe that event is not delivered to this composite.

Also, since it’s a durable subscriber we would ideally expect this message to be stored by Weblogic server. Now go to Durable Subscribers and you can observe a pending message to be delivered.

Click Show Messages to see all pending messages.

 

Click on message to see details as shown below.

 

Now shutdown EDNSubscribeAsync composite and observe corresponding durable subscribers.

Raise another CreateOrder business event and observe pending messages.

 

Bring up EDNSubscribeAsync composite and you will see a new composite instance gets generated as the pending event is delivered by EDN.

 

Also observe that corresponding Durable Subscribers are active.

Now bring up EDNSubscribe composite and observe 2 new composite instances are generated for both of the pending messages.

Also observe that all Durable Subscribers are up.

Redeployment of Composites:

There will be no change in Durable subscribers, when composites are redeployed with the same revision or different revision as the default.

Server shutdown:

Shutdown EDNSubscribeSync and EDNSubscribeASync composites and raise 2 CreateOrder and 1 UpdateOrder business events. As shown below, these will be shown as pending for corresponding Durable Subscribers.

 

Now Shutdown SOA server and restart it. Navigate to EDNTopic and observe that messages are not lost and survived the server shutdown as expected. Bring up the composites and you would observe new instances get created as shown below.

 

In the above screenshot, the first 2 instances are created for CreateOrder and 3rd instance is created for UpdateOrder business events respectively.

Un-deployment of Composites:

Now Un-deploy EDNSubscribeSync composite. Navigate to Durable Subscribers and observe that only 3 subscribers exist.

Un-deploy EDNSubscribeASync composite too and observe that Durable Subscribers is reduced to 1 as shown below.

Now un-deploy all the composites and observe that all Durable Subscribers are deleted automatically.

Durable property to No

When you set Durable property to No and deploy the composites, you will not see any of the Durable Subscribers for EDNTopic as shown below.

 

Other Observations:

  • Durable subscribers are taking a little time to become active when server is restarted and shutdown composites are started up (scenario described above in Server shutdown section).
  • Client IDs for Durable subscribers are getting created differently based on event subscription consistency level. Observed that Client ID is set as edn_wljms_xa_client for OneandOnlyOne consistency level. For Guaranteed consistency level, it’s edn_wljms_localtxn_client. This denotes Global Transaction used for OneandOnlyOne and Local Transaction used for Guaranteed consistency levels respectively.

  • 12c documentation for EDN mentions, The EDN does not support durable subscriptions (whether they are backed by native AQ or Oracle WebLogic Server JMS). The subscribing service component must be running to receive events, though we are able to achieve this using Durable Subscribers. We see the same mention in 11g documentation too.

All of the above observations are nicely summarized over here, see table 33-2.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Advertisements

Pages

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 341 other followers

Enter your email address to follow this blog and receive notifications of new posts by email.