I m implementing Pub/Sub model using JMS. I send a message from Pub to all Subscribers. I want that subscribers should get filtered messages based on some string in actual message body.
For example a subscriber subscribe to a topic 'sports' and should receive only those posts which has keyword 'cricket' in it in the message text body.
p.s. I dont want to use message selectors.
How can I implement this.
Thanks and Regards.
Take a look at apache camel. It provides a means of routing and filtering messages and has excellent integration with Active MQ.
You can use no mechanism for filtering messages on a topic based on the Message Body contents. Usually a JMS Selector is used for filtering messages but even this does not work for Body Contents:
From The Java EE 6 Tutorial:
A
message selector cannot select messages on the basis of the content of the message body..
The issue here is that you have to first receive (that is consume) the message and then extract its contents which precludes the case of any kind of Body filtering.
You cannot do that with JMS itself.
What you typically do is to make the sending application use different queues depending on message type (orders, customer prospects, invoices, status reports or whatnot). If you don't want to use separate queues, you can at least make the sending application mark the message with some property that you can filter on using a selector.
In some cases, where you still need to do routing and/or filtering based on the actual content of a message, there are tailor made software for that kind of thing. Apache Camel and Mule ESB are two options.
Related
I need to post multiple bot replies (responses determined dynamically) to the same channel.
The obvious way seems to be to do an HTTP POST for each message in succession using this API method: https://api.slack.com/methods/chat.postMessage
Is there a way to send messages to Slack in bulk to post to the same channel? The order in which the messages get rendered need not be important for me.
No, there is no bulk variant. So you basically need to build your own bulk message sender.
Keep in mind that there is a request limit of 1 message per second or your API requests will fail.
There also is a 3 seconds request time-out for many requests between Slack and your app. (e.g. for direct response to slash commands). So if your bot needs to send many messages you want to use an approach that allows you to send them asynchronously.
One solution to this problem that works very well for me is to use a messaging queue for all Slack messages sent from my bots.
You can try multiple messages as attachements -> https://api.slack.com/reference/messaging/attachments
Request channel is a scatter channel. Sending request to 3 micro services(outbound gateways) . I was expecting different span for different services to track properly. I am using spring sleuth. Used DefaultHeaderMapper to map header.
My questions are:
1. How span id is generated, where server/client side? Any reference document to study.
2. How to resolve the issue of duplicate span in spring integration?
The span is generated on the client side when the message is sent. Then it gets propagated when the message arrives. If a message arrived and there were no messaging headers then the span will be created. Everything is written in the documentation (http://cloud.spring.io/spring-cloud-sleuth/spring-cloud-sleuth.html) so just read the docs. As for the resolution of duplicate spans I have no idea what you are talking about so I guess you need to provide a more detailed description or a sample to replicate the problem.
This question is related to Websphere MQ. I have a requirement where in I have to route messages based on the content of the message.
I know about the concept of selectors in WMQ subscriptions and I have also been successful in doing this based on the Message Headers (using MQRFH2 )
I now need to filter messages based on the payload which are XMLNSC and have a valid namespace associated with it.
Eg:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:test xmlns:ns0="abc.com/is/2009/schemas/envelope/">
<flag>Y</flag>
</ns0:test>
If I have to accept messages if the flag is 'Y' only, then how do I set the selector in my subscriptions?
Please let me know.
Thanks in advance.
Any WebSphere MQ selection information must either be in the message header or a message property. WMQ is tuned to move messages as far downstream as possible, as quickly as possible, and does not do anything with message payloads other than to deliver them. Any functionality based on data in the message body requires one of IBM's ESB solutions such as IIB, or else to write code to inspect the payload and take the appropriate action.
If at all possible, the application creating the messages should place the selection field into a message property. If that isn't possible, a program can intercept the message, evaluate the payload and set the property, then re-queue the message.
I m implementing Pub/Sub model using JMS. I send a message from Pub to all Subscribers. I want that subscribers should get filtered messages based on some string in actual message body.
For example a subscriber subscribe to a topic 'sports' and should receive only those posts which has keyword 'cricket' in it in the message text body.
p.s. I dont want to use message selectors.
How can I implement this.
Thanks and Regards.
Take a look at apache camel. It provides a means of routing and filtering messages and has excellent integration with Active MQ.
You can use no mechanism for filtering messages on a topic based on the Message Body contents. Usually a JMS Selector is used for filtering messages but even this does not work for Body Contents:
From The Java EE 6 Tutorial:
A
message selector cannot select messages on the basis of the content of the message body..
The issue here is that you have to first receive (that is consume) the message and then extract its contents which precludes the case of any kind of Body filtering.
You cannot do that with JMS itself.
What you typically do is to make the sending application use different queues depending on message type (orders, customer prospects, invoices, status reports or whatnot). If you don't want to use separate queues, you can at least make the sending application mark the message with some property that you can filter on using a selector.
In some cases, where you still need to do routing and/or filtering based on the actual content of a message, there are tailor made software for that kind of thing. Apache Camel and Mule ESB are two options.
I am trying to write an HL7 message parser that will send a specified acknowledgment back to a messaging engine so that my applicaiton may receive the next message in line.
The interface engine that is sending the messages is call VISTA (has anyone ever worked with it?) I have been told that it expects to receive an 'Ackknowledgement ACK' if there is a value in MSH field 15. In all of the messages that I am currently receiving, I am getting a value of 'AL'.
I have basically set up my application to send a TCP message to a hostname/ip:portnumber that can be set before the applicaiton is started.
If possible, could someone provide a sample ACK message (without sensitive data of course) AND the non-whitspace characters that wrap the message?
I would like to make sure that I know what I need to send back to the sending application.
After some further research of my own, and the help of responses to this post, I have found that the following items are required to be included for the sending applicaiton to accept my ACK and move onto the next message.
The ACK must contain the following:
MSH|^~\&|Receiving App|Receiving App ID|Sending App|Sending App ID|DateTime of Message||"ACK"|Message Control ID|Processing ID|Version ID
MSA|AE <or> AR <or> AA|Message Control ID (MSH 9 from the sent message)
ERR| This particular segment is not required by the sending application
The problem I was experiencing pertained to my Sending and Receiving App IDs and Names were swapped.
Thanks for the help!
I haven't worked with VISTA, and my only current setup is returning an error ACK due to some application issue that I won't be able to debug right now, but in case it's helpful here's the error ACK:
MSH|^~\&|||||20100630130105.496-0500||ACK|20||2.3
MSA|AE|H20091222063637.9834
ERR|^^^207&Application Internal Error&HL70357
Note that this is HL7 v2.3 - the format may be different for other versions.