I am trying to set custom string as Message ID via MQJavaClient what I have done so for is below:
String I want to place in message id
example :92f5fd96300e8dce
Get hex number from online[codebeautify.org]
example:39326635666439363330306538646365
In Java client code as below
String str = "39326635666439363330306538646365";
sendmsg.messageId = str.getBytes();
When try to print messageid, it is giving some other results
sendmsg.messageId : [B#1b40d5f0
Still needed messageid is not populated with MQ Message.
Please help on this to set custom message ID for MQ Message.
Roger / Josh 26 dec 2017
Need help on this
If you need/want to store your own message id or transaction id then use a message property or the Correlation ID field of the MQMD - just don't use the MQMD's Message ID.
In our application , we are using both msgid/txnid and correlation id.
msgid/txnid will different for each transaction(should be same for request an response).
correlation id will same across all transactions.
What am trying now?
1.System A and System B talking via MQs
2.Now suddenly System B is responding with different format as response and System A is not able perform its operations.
3.Now my job is to simulate System B response via java client.
4.I found in our application we use both msgid and correl id
5.I am done with correl id and its reading perfectly by System A.
6.But this msgid is NOT populating via java client and showing as msgid as null in logs.
Bad idea, very bad idea to generate your own Message ID in IBM MQ. MQ will automatically generate a unique Message ID for the message when your application issues an MQPUT and/or MQPUT1.
If you need/want to store your own message id or transaction id then use a message property or the Correlation ID field of the MQMD - just don't use the MQMD's Message ID.
Related
I have noticed that forwarded email from a different sender for an existing case if there a case already exists in the system, is getting associated with the same case instead of creating a new case in the queue.
Explaining the Scenario:
1. I have configured a mailbox and 'Dummy' Queue for email address say: dummy#mycompanydomain.com
2. Case Creation rule is configured for any email coming to this queue.
Sending Emails in 2 different scenarios:
Sent email from ABC#outlook.com
TO : DEF#outlook.com & XYZ#outlook.com
"Replied to All" from DEF#outlook.com to ABD#outlook.com, XYZ#outlook.com and Added dummy#mycompanydomain.com email address as well.
New Ticket got created in 'Dummy' queue. – Working as expected.
"Replied to All" from XYZ to ABD, DEF and Added dummy#mycompanydomain.com mailbox as well.
New Ticket got created in ‘'Dummy' queue. – Working as expected.
Sent email from ABC#outlook.com
TO : DEF#outlook.com & XYZ#outlook.com
Replied to All from DEF to ABD#outlook.com, XYZ#outlook.com and Added dummy#mycompanydomain.com email address as well.
New Ticket got created in "Dummy" queue. – Working as expected.
Forwarded from XYZ to dymmy#mycompanydomain.com mailbox.
Incoming Email got associated with existing Ticket in ‘Dummy’ queue. -- Is this an expected behavior or a product bug?
Incoming Email got associated with existing Ticket in ‘Dummy’ queue. -- Is this an expected behavior or a product bug?
Also be aware of the type of matching you are doing in you SSS. If the matching is via regular expression or token a forwarded email will result in a matching Subject.
I am trying to send multipart (concatenated) messages using Kannel.
Currently, Kannel is configured to call a dlr url (which is a PHP script) that does some stuff with the delivery report.
When sending single message (ie a message that has 10 characters), it does get delivered to my mobile phone and Kannel calls the dlr url twice, both times returning the foreign message ID - both when the dlr status code was 8, which means that it was accepted by SMSC, and when the dlr status code was 1, which means the message was delivered (as it really was).
Now, that works all great but when I try to send a multipart message (ie a message that has 250 characters), it again gets delivered to my phone as one message (as I set the concatenation parameter to true), but when Kannel called that dlr url when status code was 8 (accepted by SMSC) - it didn't provide any foreign message id, as it would normally in the previous example with message of 10 characters.
I could see in the logs that Kannel indeed received two foreign message ID's from the SMSC (ie 123 and 124), but when calling the dlr url on status code 8 (accepted by SMSC) Kannel never provided those IDs so the field in the database I use to store these IDs has been set from NULL to an empty string.
What is really confusing is that once the multi-part message got delivered to my phone, Kannel called that dlr url again with status code of 1 (delivered) and it passed the foreign message id of the first message, which is what I want to be passed on any status code.
So my question is - how can I make Kannel use that foreign message id when calling the dlr url when status code is 8 (accepted by SMSC)? It works when status code is 1 (delivered) but not when status code is 8.
Note: I am using Kannel 1.4.4 but I am willing to upgrade if there's a newer version with this feature included.
So I have request/response queues that I am putting messages on and reading messages off from.
The problem is that I have multiple local instances that are reading/feeding off the same queues, and what happens sometimes is that one instance can read some other instance's reply message.
So is there a way I can configure my JMS, using spring that actually makes the instances read the messages that are only requested by them and not read other instance's messages.
I have very little knowledge about JMS and related stuff. So if the above question needs more info then I can dig around and provide it.
Thanks
It's easy!
A JMS message have two properties you can use - JMSMessageID and JMSCorrelationID.
A JMSMessageId is supposed to be unique for each message, so you could do something like this:
Let the client send a request, then start to listen for responses where the correlation id = the sent message id. The server side is then responsible for copying the message id of the request to the correlation id of the response. Something like: responseMsg.setJMSCorrelationID(requestMsg.getJMSMessageID());
Example client side code:
Session session = getSession();
Message msg = createRequest();
MessageProducer mp = session.createProducer(session.createQueue("REQUEST.QUEUE"));
mp.send(msg,DeliveryMode.NON_PERSISTENT,0,TIMEOUT);
// If session is transactional - commit now.
String msgID = msg.getJMSMessageID();
MessageConsumer mc = session.createConsumer(session.createQueue("REPLY.QUEUE"),
"JMSCorrelationID='" + msgId + "'");
Message response = mc.receive(TIMEOUT);
A more performant solution would be to use dedicated reply queues per destination. Simply set message.setJMSReplyTo(session.createQueue("REPLY.QUEUE."+getInstanceId())); and make sure the server side sends response to requestMsg.getJMSReplyTo() and not to a hard coded value.
I am building an integration between Salesforce and Twilio that sends/receives SMS using TwilioForce REST API. The main issue is getting around the 10-call API limit from Salesforce, as well as the prohibition on HTTP call outs from a trigger.
I am basing the design on Dan Appleman's Asynchronous Request processes, but in either Batch mode or RequestAsync(), ASync(), Sync(), repeat... I'm still hitting the limits.
I'd like to know how other developers have done this successfully; the integrations have been there for a while, but the examples are few and far between.
Are you sending unique messages for each record that has been updated? If not, then why not send one message to multiple recipients to save on your API limits?
Unfortunately, if you do actually need to send more than 10 unique messages there is no way to send messages in bulk with the Twilio API, you could instead write a simple application that runs on Heroku or some other application platform that you can call out to that will handle the SMS functionality for you.
I have it working now using the following structure (I apologize for the formatting - it's mostly pseudocode):
ASyncRequest object:
AsyncType (picklist: 'SMS to Twilio' is it for now),
Params (long text area: comma-separated list of Ids)
Message object:
To (phone), From (phone), Message (text), Sent (boolean), smsId (string), Error (text)
Message trigger: passes trigger details to CreateAsyncRequests() method.
CreateAsyncRequests: evaluate each new/updated Message__c; if Sent == false for any messages, we create an AsyncRequest, type=SMS to Twilio, Params += ',' + message.Id.
// Create a list to be inserted after all the Messages have been processed
List requests = new List();
Once we reach 5 message.Ids in a single AsyncRequest.Params list, add it to requests.
If all the messages have been processed and there's a request with < 5 Ids in Params, add it to requests as well.
If requests.size() > 0 {
insert requests;
AsyncProcessor.StartBatch();
}
AsyncProcessor implements .Batchable and .AllowsCallouts, and queries ASyncRequest__c for any requests that need to be processed, which in this case will be our Messages list.
The execute() method takes the list of ASyncRequests, splits each Params value into its component Message Ids, and then queries the Message object for those particular Messages.
StartBatch() calls execute() with 1 record at a time, so that each execute() process will still contain fewer than the maximum 10 callouts.
Each Message is processed in a try/catch block that calls SendMessage(), sets Message.smsId = Twilio.smsId and sets Message.Sent = true.
If no smsId is returned, then the message was not sent, and I set a boolean bSidIsNull = true indicating that (at least) one message was not sent.
** If any message failed, no smsIds are returned EVEN FOR MESSAGES THAT WERE SUCCESSFUL **
After each batch of messages is processed, I check bSidIsNull; if true, then I go back over the list of messages and put any that do not have an smsId into a map indexed by the Twilio number I'm trying to send them From.
Since I limited each ASyncRequest to 5 messages, I still have the use of a callout to retrieve all of the messages sent from that Twilio.From number for the current date, using
client.getAccount().getMessages('From' => fromNumber, 'DateSent' => currentDate)
Then I can update the Message.smsIds for all of the messages that were successful, and add an error message to Message.Error_on_Send__c for any that failed.
I have a WTX map which puts a message on WMQ "Q1". There is some other application which reads the message from "Q1" and then processes the message and places the response on the queue specified in "ReplyToQ" available on MQ Header information.
I am not able to find a command parameter to add the ReplyToQ in the message WTX map is placing on "Q1".
Any thoughts?
Thanks for taking the time to look at this question and helping out!
The ReplyToQueue is sent on the message header, so you must get the message with the header (-HDR) and parse it from there on your input card.
Here's the doc about the adapter's command:
http://pic.dhe.ibm.com/infocenter/wtxdoc/v8r4m1/index.jsp
You should have a type tree on the Examples to read the message with a header.
Regards,
Bruno.