Websphere equivalent for Weblogic bridge level message filter - jms

In weblogic it is possible to create a message bridge between two JMS message queues. While configuring this bridge, a message filter can be applied so that the bridge will route messages that match the filter only.
Is it possible to achieve the same with Websphere?
Specifically I'm trying to achieve this scenario.
I have one source queue on which messages are received. Each message will have a custom JMS property set up. I would like to forward the messages on the source queue, to separate queues based on the JMS property and its value. This is easily configured in WLS using message bridges with filtering. How can I do the same in WAS?
Thanks
Savio

You need to use SIB Mediation.
The WAS info center have an example called writing a routing mediation which seems like what you need.
At the bottom of the example there is a link to what to do next which also explains how to configure WAS to use that mediation.

Without writing custom code (as per your comment on Aviram's answer), it is not possible to achieve the exact same thing, but nonetheless it is possible to achieve same effect;
You say that a 'source queue' distributes messages to other 'separate queues' according to a custom JMS property. I'm assume that you have MDBs (message driven beans) configured to process messages in these separate queues.
What you can do with WebSphere is distribute messages to these MDBs directly from the 'source queue', without having to filter/distribute them to separate queues.
This is managed by using JMS Message Selectors. You can point all your MDBs to the source queue using activation specification definitions, and for each (one for each type of message) MDB, define a JMS Message Selector that matches the ones you use in WLS. This way each message is only delivered the MDB whose filter matches the message's properties. This effectively filters/distributes messages to different MDB's as in WLS.
You may read details on configuring message selectors (during development in RAD, or at/after deploy time) at infocenter. Below is a quote to give you an idea about what it look like;
messageSelector
This attribute determines the JMS message selector
that is used to select which messages the message-driven bean
receives. For example:
JMSType='car' AND color='blue' AND weight>2500
The selector string can refer to fields in the JMS message header and
fields in the message properties. Message selectors cannot reference
message body values.

For the record, we finally ended up writing our own routing algorithm within the application to ensure that messages are sent to separate queues for each client. This way we are independent of app server implementations and the integration effort is the same across app servers, viz., adding custom queues per integrating client.
In brief, We published a JMS custom property that must be set. Using a published convention, we look up for a queue and send responses to the queue. If the property is not set, a default queue is created to route all messages. If the property is set, and the queue cannot be found an exception is raised and processing halted.
This suited our purpose. Hope it helps...

Related

How to configure a consumer to external queue (another application) with MassTransit

I have a publisher in one application, that publishes a message with an specific message type.
This message will be consumed by another application (both using MassTransit) and I'm getting the message skipped.
I think the problem is the message type config in the envelope.
The question is: How can I configure my consumer to accept a specific message type?
I don't want to change the producer, just configure the consumer, if it's possible.
Messages in the _skipped queue typically indicate a message type mismatch, most commonly caused by using different namespaces for the producer and the consumer.
Answered here and elsewhere, also highlighted in the documentation.

MessageGroups with Spring and Websphere MQ

I am looking options to implement feature like Active MQ message groups in my application. This application is based on Spring and uses Websphere MQ as JMS provider. I cannot change JMS provider to ActiveMQ due to client constraints.
Use Case : Messages arrive in bulks on queue 1 where they are picked by listener and split into chunks and en-queued to the queue 2. Queue 2 has a single threaded listener which processes messages one after another but this behavior is leading to performance issues where there are too many messages on Queue 2. Also since bulk can have some related messages i.e. Object Create and Object Update, simply having parallel consumers wont solve the problem. As messages need to be grouped based on order Id (or some other)attribute and then this group needs to be processed by exclusive consumer.
I cant find any feature in MQ or Spring JMS to implement this unlike Message Groups provided by Active MQ.

Spring integration dsl with multiple listeners on same queue but with different selectors

I am trying to get multiple listeners configured on same queue, but with different message selector. I am using Solace JMS provider.
The behavior is that the first loaded listener will have its selector registered and is receiving the messages.
the second listener is NOT receiving the message. And using Spring integration DSL 1.1.3
what could be wrong?
I tried with two different Queue connection factory, but could not get it working.
How can we have two Selective consumers configured ?
I think you should start from your vendor first of all and try to figure out if it supports concurrent selective consumers.
Although you have to bear in mind that with the Queue only one consumer accepts message anyway. So, if first one is able to process the message, the second one won't receive it, even with different selector.
Consider to switch to the Topic.

Pattern for handeling multiple message types with spring JMS in a multi module maven setup

I' m currently investigation the implementation of queue's or topic, based on activeMQ within our project. The setup is pretty straight forward in which we are using maven modules to seprate business logic according to the business domain. One common module allows us to assemble common logic.
simplified Example:
common module
products module
clients module
One of the requirements is that certain operations are asynchronous towards a backend (by means of a activeMQ) which in turn responds with a result message.
The second requirement is that it should be possible to horizontally scale the application by creating a new deployable artifact with only that module that needs more juice.
We are using spring 4 with of course jms and activeMQ.
On to my question. We would like to use just one queue or topic for backend connectivity. Which would mean our common module would handle jms configuration (jms factory, jms-configuration) and different types of messages will be send over that one queue/topic.
How would can I make sure that product related messages get handled by the "products" module and client related messages get handled by the "clients" module? How can I make sure only one of the "products" modules logic would handle a message if the module was deployed two times? What approach would you recommend or is this one queue/topic "nuts"?
I was myself thinking in the direction of using a topic because of the publ/subsc pattern... , or maybe queue listener acting as publisher in a observer pattern to which product- or client subscribers might subscribe to take over handling the message?
Thanks for your help.
Why using a Topic if you want just one of the "products" modules to handle one message? With Topic you'd have one message - multiple subscribers each getting the message. The Queue ensures only one consumer gets a message (point-to-point), with Topic you'd have one message dispatched to all subscribers.
Regarding the "filtering" of messages, this should be something provider specific. Looking at ActiveMQ docs I see this. So, basically each consumer should get the messages the broker, based on selector, will dispatch. I don't know the specifics, but this would be the first place I would start this investigation.
On the same idea, have a look at this discussion from the Spring forum. It is, indeed, related to Spring Integration, but it's on the same idea of message selection. On the other hand, you could consider adopting Spring Integration in your project: it's kind of an abstraction of integration patterns and fits well with everything message oriented.
Few interesting ideas from that forum post:
JmsTemplate from Spring contains a doReceive method that takes as a parameter a String as message selector
Message selectors are in the JMS spec (scroll down to "Message Properties" section)
Relevant section in the Spring Integration documentation is here

Read JMS properties from an InOnly message in Camel

When sending (InOnly) JMS messages with Apache Camel, can I read back the different JMS headers that might have been set automatically on the message, when it was sent?
from("foo:bar")
.to(ExchangePattern.InOnly,"jms:queue:whatever")
.log("msg id set = ${in.header.JMSMessageId}");
I just can't figure out how to send the message "one way" but keeping the sent JMS message as "in" message in the route afterwards.
Background:
I know that I can present some values, but it would be easier if they where set by the actual JMS implementation. For instance, in this case, I want to work with WebSphere SIBus, WebSphere MQ and ActiveMQ. It's best to rely on WebSphere MQs internal message id format, because it will only index certain message formats. It might be similar aspects on the WebSphere SIBus implementation.
This feature is available starting at 2.10.3 and 2.11.0.

Resources