Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JMS Cache Coordination: setDeliveryMode to be non persistent on the TopicPublisher(JMS Cache Coordination: messages deliveryMode)
JMS Cache Coordination: setDeliveryMode to be non persistent on the TopicPublisher [message #1708247] Mon, 14 September 2015 22:59 Go to next message
Leny Tan is currently offline Leny TanFriend
Messages: 6
Registered: September 2015
Junior Member
We are enabling Cache Coordination using JMS in our application. Currently, we're in version EclipseLink 2.2.0.

We need to have a way to setDeliveryMode of the messages to be NON PERSISTENT. We currently are using ActiveMQ JMS Broker.

According to the Apache ActiveMQ documentation, we can either:
1. Set the NON_PERSISTENT message delivery flag on your MessageProducer
2. Set the persistent=false flag in the <broker/> element of the Xml Configuration or on the property BrokerService

Unfortunately, option#2 is not an option for us since we don't own the broker and it's managed by other team and the broker is not a dedicated broker just for our use cases.

Therefore, we are left with option#1, which is to set NON_PERSISTENT message delivery flag on the MessageProducer.

Looking into the EclipseLink code and debug into it, EclipseLink has its own implementation for JMS remote connection and is done via JMS Publisher (JMSTopicRemoteConnection). So, for publishing connection externally it's done via executeCommandInternal method. In this method, they'll publish entity changed to the topic. I don't see a way to override or EclipseLink exposing a way to setDeliveryMode.

Hope to get some pointers, suggestions, or see if anyone have a better solution than forking EclipseLink.

thanks
Leny
Re: JMS Cache Coordination: setDeliveryMode to be non persistent on the TopicPublisher [message #1708686 is a reply to message #1708247] Fri, 18 September 2015 17:02 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
The jms TopicPublisher is accessible from within the JMSTopicRemoteConnection that gets created. I haven't tested accessing it, but believe you would be able to by using the Session to get the RemoteCommandManager, calling rcm.getTransportManager().getConnectionsToExternalServicesForCommandPropagation().values().iterator().next() will give you the JMSTopicRemoteConnection which you can call getPublisher() on.

The problem will be if the connection ever gets disconnected, there isn't a call back you can use set the value on new TopicPublishers. The only way I can see to do that is to create your own JMSPublishingTransportManager or JMSTopicTransportManager subclass and override the createExternalConnection method to obtain the TopicPublisher from the created JMSTopicRemoteConnection and set the value you want. As you've likely seen, there isn't a great way to have EclipseLink to automatically start using your instance instead of its own TransportManager classes without further changing EclipseLink internals, which I don't recommend. Instead, I would use a session customizer to replace the TransportManager within the session's RemoteCommandManager with your own - initializing your instance with all the relevant properties from the already configured JMS transport manager so as to use the EclipseLink JMS settings, or initializing them how ever you prefer. The createExternalConnection method in your TransportManager class will then get called when ever connections are created - starting when the session logs in.

Hope this helps

Chris
Re: JMS Cache Coordination: setDeliveryMode to be non persistent on the TopicPublisher [message #1709065 is a reply to message #1708686] Wed, 23 September 2015 16:39 Go to previous message
Leny Tan is currently offline Leny TanFriend
Messages: 6
Registered: September 2015
Junior Member
Thanks for your suggestion Chris. We decided to use AspectJ to weave setDeliveryMode to the TopicPublisher before publish method call.
Previous Topic:Eclipse Moxy API - Unmarshaller encoding issue
Next Topic:GebericEntity<T> json when bootstrapping JAXBXContext
Goto Forum:
  


Current Time: Thu Apr 18 17:22:41 GMT 2024

Powered by FUDForum. Page generated in 0.03760 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top