By using composite source in Mule ESB, it is possible to get input from different queue at a time. Is there any method to get to know the input WMQ node name.e.g.
I have 2 queue (ABC & XYZ) from which input can be obtained and further transformation can be applied. Is there any possible way to get to know the queue name from which the message received.
There is no need to use composite-source if you need to behave differently based of the queue name.
What I would recomend is to design your flows acordingly to your needs:
flow(queueA)->flowVars.queueName="queueA"->flow-ref(realwork)
flow(queueB)->flowVars.queueName="queueB"->flow-ref(realwork)
flow(realwork)->dotherealworkhere
Related
I am using ActiveMQ to store messages to be used later. It is working as expected, but there is a specific scenario I need to fit which I cannot figure out.
The short question is this.
Is there a way to run a query on the queue to find out all messages with certain header values?
The problem in detail is this :
So there is a set of data that is coming in multiple messages and the requirement is to use that data only after all messages for that has come in.
So if the dataset has lets say 50 messages i need to wait for those 50 messages and then read them in.
I am adding headers to each message to denote they belong to a certain set.
Like "TotalSets"=50 , "SetId"=39 .
I would like to write a thread that keeps tracing if all sets for a particular batch has arrived.
NMS is a .NET equivalent to the JMS messaging API so the means of filtering messages is the same as in JMS, your subscription applies a JMS Message Selector when created to tell the broker what messages it is interested in. The session methods to create MessageConsumer instances have variants that accept the selector using the JMS defined syntax which is your means of filtering messages.
I have mule app with single mainFlow. Flow receives jms-message from MQ by quartz:inbound-endpoint, processes it and puts in another queue. Messages are independed. Is it possible to run multiple instances of my flow for concurrent message processing?
enter image description here
Yes. As long as your flow is neither transactional or two-way (request-response), you can set-up various asynchronous processing strategies.
You can add it either visually in the Studio in the flow's properties or by manually adding the attribute processingStrategy="...yourStrategy" to the flow's XML declaration.
For an in-depth guide to what everything means and does, see https://docs.mulesoft.com/mule-user-guide/v/3.8/flow-processing-strategies
I need to create an "accumulator" service to be used by Mule ESB applications.
This service will hold inbound messages until a certain number are received and then package those messages into a single outbound message.
This is the first time I've needed to write an ESB application that needs to maintain state (the collection of previously received messages) across inbound messages and I'm not quite sure how to get started.
I think what I need is a place to hang a reference to a data structure that holds my lists of inbound messages, but I'm not sure.
What's the best (most productive, most consistent with ESB best-practices) mechanism for managing "application-level" (i.e. cross-message) state data?
Thanks.
For this scenario you need to use the aggregator pattern. Please follow the below link .
http://www.mulesoft.org/documentation-3.2/display/32X/Message+Splitting+and+Aggregation
I have to implement this scenario:
An external application publish message to rabbitmq.
This message has a client_id property. We can place this id to routing key or message header or some other property.
I have to implement sharding in a exchange routng logic - the message should be delivered to specific queue based on the client_id range.
Is it possible to implement in a standard exchanges?
If not what exchange should I take as the base?
How to dynamicly change client_id ranges?
Take a look at the rabbitmq plugin. It's included in the RabbitMQ distribution from v3.6.0 onwards.
Just have your producer put enough info into the routing key that causes the message to go into the right queue on the other side of the Exchange.
So for example, create two queues called 1 and 2 and bind them with routing keys matching the names. Then have your producer decide which routing key to use when producing the event message. Customers with names starting with letters a-m go to 1, n-z go to 2, you get the idea. It pushes the sharding to the producer but that might be OK for your application.
AMQP doesn't have any explicit implementation of sharding, but its architecture should help you to do that.
Spreading messages to several queues is just a rabbitmq challenge (and part of amqp specification), and with routing, way you can attach hetereogeneous consumers to handle specific messages routed via the same exchange. Therefore, producer should push a specific key to be consumed by specific queue/consumer...
You can decide to make a static sharding, perhaps you have 10 queues with one consumer per queue. You could implement a consistent hashing function such that key is CLIENT_ID % 10.
Another ways and none static solutions could be propoused, and you can try to over this architecture.
I was wondering whether anyone had any experience dynamically setting the name of the flow I want to redirect to in Mule? The use case is that I might have data coming in and I want to route the request to a specific flow based on the data coming in. However, the mule-config may not know of this flow until runtime, so I need to select a flow that corresponds to the data in a certain incoming field.
Many thanks.
Selecting a destination flow is usually done by sending a message to the inbound endpoint of the desired flow.
For example, if you use VM inbound endpoints in your different flows, you can then at runtime use a dynamic VM outbound endpoint that will target the right VM inbound endpoint.