MQ Message in the Request and Reply store in Database
Based on multiple analysis through google I created a Java based MQ JMS client . Basically I am new to MQ and
got few doubts whether the code which I created will work properly for the below Request and Reply.
Request and Reply message:
REQUEST(SERVICE,10,CREATE_TEST,MSGID,15,FGD024049364194,TESTID,4,
USMQ,SRID,8,#MSTD,EMPID,5,8104,LOC,4,QR,AT-RP,4,QR,RTR,
7,2624931,UVT-ORD-SYS,4,CHAT,UVT-REQ,1,S,UVT-ORD,9,QT0046259,VTRD-2)RETURN();
REPLY(MSGID,15,FGD024049364194,DESTID,4,TRMQ,EMPID,5,8104,LOC,4,RTR,VTCT,0,
,UVT-DELCMNT,0,,UVT-DEL-REA,0,,UVT-DLVRY-FLG,1,N,UVT-DLVRY-STUS,1,
10,CREATE_TEST,TKT-NBR,7,2624931,USERID,8,#AMSATD)
MESSAGE(INFO,TEST-GROUP,5,PS,INFO,UVTTS,49,+00 INVALID/NORMAL,VICE,62,
00000 UPDATE SUCCESSFUL 3734931,INFO,STSUTITMEOUT,60,+0000 INVALID/OUT OF WORLD.);
My requirement is store the above Request message in a table in the oracle database and I want to
read the message from the table and put in the Queue which will interact the other system(third party).
The other systeme will reply the message as above and I need to store the reply message along with the Message Id in the same read table.
Please clarify My doubt and correct me what i need to change in the code in case wrong:
1) In the Request there is a MSG Id availbale and also in the Reply there is a messge ID. How it will works in my scenario
I read in some site "like a MessgeID is automatically generated for you, and you can't change that behaviour".
so in my scenario as in the below code what message id will get.Is it correct?
2) When I read the message do I get complete above Reply message or only the Message mentioned in Reply.
Please clarify my above doubts:
code for Write method:
public void write(List<Createbean> createbeanList) throws MQException
{
try {
MQQueueManager qMgr = new MQQueueManager(qManager, env);
// Set up the options on the queue we wish to open
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
// Now specify the queue that we wish to open and the open options
log.info("Accessing queue: "+qName);
MQQueue queue = qMgr.accessQueue(qName, openOptions);
// Define a simple WebSphere MQ Message ...
MQMessage msg = new MQMessage();
msg.format = MQC.MQFMT_STRING;
msg.format = MQC.MQFMT_STRING;
msg.feedback = MQC.MQFB_NONE;
msg.messageType = MQC.MQMT_DATAGRAM;
for (Createbean createBean : createbeanList) {
String createMessage =createBean.getMessage();
msg.writeString(createMessage);
}
// Specify the default put message options
MQPutMessageOptions pmo = new MQPutMessageOptions();
// Put the message to the queue
queue.put(msg, pmo);
// Close the queue
queue.close();
// Disconnect from the QueueManager
// logger.debug(CLASS, methodName, "Disconnecting from the Queue
// Manager");
qMgr.disconnect();
// logger.debug(CLASS, methodName, "Done!");
Read method:
private void read() throws MQException
{
int openOptions = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INPUT_SHARED | MQC.MQOO_BROWSE;
MQQueue queue = _queueManager.accessQueue( inputQName,
openOptions,
null, // default q manager
null, // no dynamic q name
null ); // no alternate user id
log.info("MQRead v1.0 connected.n");
int depth = queue.getCurrentDepth();
log.info("Current depth: " + depth + "n");
if (depth == 0)
{
return;
}
MQGetMessageOptions getOptions = new MQGetMessageOptions();
//getOptions.options = MQC.MQGMO_NO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING + MQC.MQGMO_CONVERT;
getOptions.options=MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;
getOptions.matchOptions=MQC.MQMO_NONE;
getOptions.waitInterval=5000;
long messageCount = 0;
boolean thereAreMessages=true;
while(thereAreMessages)
{
if(messageCount >0){
MQMessage message = new MQMessage();
try
{
message.messageId = MQC.MQMI_NONE;
queue.get(message, getOptions);
log.info(" MsgId : ");
String messageID= dumpHexId(message.messageId);
String msg = message.readString(message.getMessageLength());
log.info("Browsed message: " + msg);
log.info("Actually get message?");
byte b = new byte[message.getMessageLength()];
message.readFully(b);
createDAO rmdao = new createDAO();
rmdao.updateCreate(new String(b),messageID);
log.info(new String(b));
message.clearMessage();
/************************************************/
/* Reset the options to browse the next message */
/************************************************/
getOptions.options= MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_NEXT;
}
Thanks in advance
java ibm-mq
add a comment |
Based on multiple analysis through google I created a Java based MQ JMS client . Basically I am new to MQ and
got few doubts whether the code which I created will work properly for the below Request and Reply.
Request and Reply message:
REQUEST(SERVICE,10,CREATE_TEST,MSGID,15,FGD024049364194,TESTID,4,
USMQ,SRID,8,#MSTD,EMPID,5,8104,LOC,4,QR,AT-RP,4,QR,RTR,
7,2624931,UVT-ORD-SYS,4,CHAT,UVT-REQ,1,S,UVT-ORD,9,QT0046259,VTRD-2)RETURN();
REPLY(MSGID,15,FGD024049364194,DESTID,4,TRMQ,EMPID,5,8104,LOC,4,RTR,VTCT,0,
,UVT-DELCMNT,0,,UVT-DEL-REA,0,,UVT-DLVRY-FLG,1,N,UVT-DLVRY-STUS,1,
10,CREATE_TEST,TKT-NBR,7,2624931,USERID,8,#AMSATD)
MESSAGE(INFO,TEST-GROUP,5,PS,INFO,UVTTS,49,+00 INVALID/NORMAL,VICE,62,
00000 UPDATE SUCCESSFUL 3734931,INFO,STSUTITMEOUT,60,+0000 INVALID/OUT OF WORLD.);
My requirement is store the above Request message in a table in the oracle database and I want to
read the message from the table and put in the Queue which will interact the other system(third party).
The other systeme will reply the message as above and I need to store the reply message along with the Message Id in the same read table.
Please clarify My doubt and correct me what i need to change in the code in case wrong:
1) In the Request there is a MSG Id availbale and also in the Reply there is a messge ID. How it will works in my scenario
I read in some site "like a MessgeID is automatically generated for you, and you can't change that behaviour".
so in my scenario as in the below code what message id will get.Is it correct?
2) When I read the message do I get complete above Reply message or only the Message mentioned in Reply.
Please clarify my above doubts:
code for Write method:
public void write(List<Createbean> createbeanList) throws MQException
{
try {
MQQueueManager qMgr = new MQQueueManager(qManager, env);
// Set up the options on the queue we wish to open
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
// Now specify the queue that we wish to open and the open options
log.info("Accessing queue: "+qName);
MQQueue queue = qMgr.accessQueue(qName, openOptions);
// Define a simple WebSphere MQ Message ...
MQMessage msg = new MQMessage();
msg.format = MQC.MQFMT_STRING;
msg.format = MQC.MQFMT_STRING;
msg.feedback = MQC.MQFB_NONE;
msg.messageType = MQC.MQMT_DATAGRAM;
for (Createbean createBean : createbeanList) {
String createMessage =createBean.getMessage();
msg.writeString(createMessage);
}
// Specify the default put message options
MQPutMessageOptions pmo = new MQPutMessageOptions();
// Put the message to the queue
queue.put(msg, pmo);
// Close the queue
queue.close();
// Disconnect from the QueueManager
// logger.debug(CLASS, methodName, "Disconnecting from the Queue
// Manager");
qMgr.disconnect();
// logger.debug(CLASS, methodName, "Done!");
Read method:
private void read() throws MQException
{
int openOptions = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INPUT_SHARED | MQC.MQOO_BROWSE;
MQQueue queue = _queueManager.accessQueue( inputQName,
openOptions,
null, // default q manager
null, // no dynamic q name
null ); // no alternate user id
log.info("MQRead v1.0 connected.n");
int depth = queue.getCurrentDepth();
log.info("Current depth: " + depth + "n");
if (depth == 0)
{
return;
}
MQGetMessageOptions getOptions = new MQGetMessageOptions();
//getOptions.options = MQC.MQGMO_NO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING + MQC.MQGMO_CONVERT;
getOptions.options=MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;
getOptions.matchOptions=MQC.MQMO_NONE;
getOptions.waitInterval=5000;
long messageCount = 0;
boolean thereAreMessages=true;
while(thereAreMessages)
{
if(messageCount >0){
MQMessage message = new MQMessage();
try
{
message.messageId = MQC.MQMI_NONE;
queue.get(message, getOptions);
log.info(" MsgId : ");
String messageID= dumpHexId(message.messageId);
String msg = message.readString(message.getMessageLength());
log.info("Browsed message: " + msg);
log.info("Actually get message?");
byte b = new byte[message.getMessageLength()];
message.readFully(b);
createDAO rmdao = new createDAO();
rmdao.updateCreate(new String(b),messageID);
log.info(new String(b));
message.clearMessage();
/************************************************/
/* Reset the options to browse the next message */
/************************************************/
getOptions.options= MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_NEXT;
}
Thanks in advance
java ibm-mq
In a standard request reply model the message sent would havemessageType
set toMQC.MQMT_REQUEST
and after the put completes you can read the generated message id, ex:msg.messageId
. The the app that replies would normally populate thecorrelationId
of the Reply message with the Request message'smessageId
, when you get the message you can then read the corrlation id, ex:message.correlationId
. In this way you can tie the the request and reply together. If you populate thecorrelationId
before the get MQ will look only for messages with the value you specify.
– JoshMc
Nov 13 '18 at 12:11
Hi, Please correct me as per your answer I need to set msg.messageType = MQC.MQMT_REQUEST instead of msg.messageType = MQC.MQMT_DATAGRAM; second I need to add the below code before get the Message and then store the correrlationId and message to the table. String messageID= dumpHexId(message.messageId); String correlationID = dumpHexId(message.correlationId); String msg = message.readString(message.getMessageLength()); queue.get(message, getOptions); Please correct m
– Maxtech
Nov 13 '18 at 12:33
I assume you would store messageId directly after put and store correlationId directly after get.
– JoshMc
Nov 13 '18 at 12:38
Thanks: I will store the message ID before get and correlation Id after get that way it works correct.
– Maxtech
Nov 13 '18 at 12:41
add a comment |
Based on multiple analysis through google I created a Java based MQ JMS client . Basically I am new to MQ and
got few doubts whether the code which I created will work properly for the below Request and Reply.
Request and Reply message:
REQUEST(SERVICE,10,CREATE_TEST,MSGID,15,FGD024049364194,TESTID,4,
USMQ,SRID,8,#MSTD,EMPID,5,8104,LOC,4,QR,AT-RP,4,QR,RTR,
7,2624931,UVT-ORD-SYS,4,CHAT,UVT-REQ,1,S,UVT-ORD,9,QT0046259,VTRD-2)RETURN();
REPLY(MSGID,15,FGD024049364194,DESTID,4,TRMQ,EMPID,5,8104,LOC,4,RTR,VTCT,0,
,UVT-DELCMNT,0,,UVT-DEL-REA,0,,UVT-DLVRY-FLG,1,N,UVT-DLVRY-STUS,1,
10,CREATE_TEST,TKT-NBR,7,2624931,USERID,8,#AMSATD)
MESSAGE(INFO,TEST-GROUP,5,PS,INFO,UVTTS,49,+00 INVALID/NORMAL,VICE,62,
00000 UPDATE SUCCESSFUL 3734931,INFO,STSUTITMEOUT,60,+0000 INVALID/OUT OF WORLD.);
My requirement is store the above Request message in a table in the oracle database and I want to
read the message from the table and put in the Queue which will interact the other system(third party).
The other systeme will reply the message as above and I need to store the reply message along with the Message Id in the same read table.
Please clarify My doubt and correct me what i need to change in the code in case wrong:
1) In the Request there is a MSG Id availbale and also in the Reply there is a messge ID. How it will works in my scenario
I read in some site "like a MessgeID is automatically generated for you, and you can't change that behaviour".
so in my scenario as in the below code what message id will get.Is it correct?
2) When I read the message do I get complete above Reply message or only the Message mentioned in Reply.
Please clarify my above doubts:
code for Write method:
public void write(List<Createbean> createbeanList) throws MQException
{
try {
MQQueueManager qMgr = new MQQueueManager(qManager, env);
// Set up the options on the queue we wish to open
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
// Now specify the queue that we wish to open and the open options
log.info("Accessing queue: "+qName);
MQQueue queue = qMgr.accessQueue(qName, openOptions);
// Define a simple WebSphere MQ Message ...
MQMessage msg = new MQMessage();
msg.format = MQC.MQFMT_STRING;
msg.format = MQC.MQFMT_STRING;
msg.feedback = MQC.MQFB_NONE;
msg.messageType = MQC.MQMT_DATAGRAM;
for (Createbean createBean : createbeanList) {
String createMessage =createBean.getMessage();
msg.writeString(createMessage);
}
// Specify the default put message options
MQPutMessageOptions pmo = new MQPutMessageOptions();
// Put the message to the queue
queue.put(msg, pmo);
// Close the queue
queue.close();
// Disconnect from the QueueManager
// logger.debug(CLASS, methodName, "Disconnecting from the Queue
// Manager");
qMgr.disconnect();
// logger.debug(CLASS, methodName, "Done!");
Read method:
private void read() throws MQException
{
int openOptions = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INPUT_SHARED | MQC.MQOO_BROWSE;
MQQueue queue = _queueManager.accessQueue( inputQName,
openOptions,
null, // default q manager
null, // no dynamic q name
null ); // no alternate user id
log.info("MQRead v1.0 connected.n");
int depth = queue.getCurrentDepth();
log.info("Current depth: " + depth + "n");
if (depth == 0)
{
return;
}
MQGetMessageOptions getOptions = new MQGetMessageOptions();
//getOptions.options = MQC.MQGMO_NO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING + MQC.MQGMO_CONVERT;
getOptions.options=MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;
getOptions.matchOptions=MQC.MQMO_NONE;
getOptions.waitInterval=5000;
long messageCount = 0;
boolean thereAreMessages=true;
while(thereAreMessages)
{
if(messageCount >0){
MQMessage message = new MQMessage();
try
{
message.messageId = MQC.MQMI_NONE;
queue.get(message, getOptions);
log.info(" MsgId : ");
String messageID= dumpHexId(message.messageId);
String msg = message.readString(message.getMessageLength());
log.info("Browsed message: " + msg);
log.info("Actually get message?");
byte b = new byte[message.getMessageLength()];
message.readFully(b);
createDAO rmdao = new createDAO();
rmdao.updateCreate(new String(b),messageID);
log.info(new String(b));
message.clearMessage();
/************************************************/
/* Reset the options to browse the next message */
/************************************************/
getOptions.options= MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_NEXT;
}
Thanks in advance
java ibm-mq
Based on multiple analysis through google I created a Java based MQ JMS client . Basically I am new to MQ and
got few doubts whether the code which I created will work properly for the below Request and Reply.
Request and Reply message:
REQUEST(SERVICE,10,CREATE_TEST,MSGID,15,FGD024049364194,TESTID,4,
USMQ,SRID,8,#MSTD,EMPID,5,8104,LOC,4,QR,AT-RP,4,QR,RTR,
7,2624931,UVT-ORD-SYS,4,CHAT,UVT-REQ,1,S,UVT-ORD,9,QT0046259,VTRD-2)RETURN();
REPLY(MSGID,15,FGD024049364194,DESTID,4,TRMQ,EMPID,5,8104,LOC,4,RTR,VTCT,0,
,UVT-DELCMNT,0,,UVT-DEL-REA,0,,UVT-DLVRY-FLG,1,N,UVT-DLVRY-STUS,1,
10,CREATE_TEST,TKT-NBR,7,2624931,USERID,8,#AMSATD)
MESSAGE(INFO,TEST-GROUP,5,PS,INFO,UVTTS,49,+00 INVALID/NORMAL,VICE,62,
00000 UPDATE SUCCESSFUL 3734931,INFO,STSUTITMEOUT,60,+0000 INVALID/OUT OF WORLD.);
My requirement is store the above Request message in a table in the oracle database and I want to
read the message from the table and put in the Queue which will interact the other system(third party).
The other systeme will reply the message as above and I need to store the reply message along with the Message Id in the same read table.
Please clarify My doubt and correct me what i need to change in the code in case wrong:
1) In the Request there is a MSG Id availbale and also in the Reply there is a messge ID. How it will works in my scenario
I read in some site "like a MessgeID is automatically generated for you, and you can't change that behaviour".
so in my scenario as in the below code what message id will get.Is it correct?
2) When I read the message do I get complete above Reply message or only the Message mentioned in Reply.
Please clarify my above doubts:
code for Write method:
public void write(List<Createbean> createbeanList) throws MQException
{
try {
MQQueueManager qMgr = new MQQueueManager(qManager, env);
// Set up the options on the queue we wish to open
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
// Now specify the queue that we wish to open and the open options
log.info("Accessing queue: "+qName);
MQQueue queue = qMgr.accessQueue(qName, openOptions);
// Define a simple WebSphere MQ Message ...
MQMessage msg = new MQMessage();
msg.format = MQC.MQFMT_STRING;
msg.format = MQC.MQFMT_STRING;
msg.feedback = MQC.MQFB_NONE;
msg.messageType = MQC.MQMT_DATAGRAM;
for (Createbean createBean : createbeanList) {
String createMessage =createBean.getMessage();
msg.writeString(createMessage);
}
// Specify the default put message options
MQPutMessageOptions pmo = new MQPutMessageOptions();
// Put the message to the queue
queue.put(msg, pmo);
// Close the queue
queue.close();
// Disconnect from the QueueManager
// logger.debug(CLASS, methodName, "Disconnecting from the Queue
// Manager");
qMgr.disconnect();
// logger.debug(CLASS, methodName, "Done!");
Read method:
private void read() throws MQException
{
int openOptions = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INPUT_SHARED | MQC.MQOO_BROWSE;
MQQueue queue = _queueManager.accessQueue( inputQName,
openOptions,
null, // default q manager
null, // no dynamic q name
null ); // no alternate user id
log.info("MQRead v1.0 connected.n");
int depth = queue.getCurrentDepth();
log.info("Current depth: " + depth + "n");
if (depth == 0)
{
return;
}
MQGetMessageOptions getOptions = new MQGetMessageOptions();
//getOptions.options = MQC.MQGMO_NO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING + MQC.MQGMO_CONVERT;
getOptions.options=MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;
getOptions.matchOptions=MQC.MQMO_NONE;
getOptions.waitInterval=5000;
long messageCount = 0;
boolean thereAreMessages=true;
while(thereAreMessages)
{
if(messageCount >0){
MQMessage message = new MQMessage();
try
{
message.messageId = MQC.MQMI_NONE;
queue.get(message, getOptions);
log.info(" MsgId : ");
String messageID= dumpHexId(message.messageId);
String msg = message.readString(message.getMessageLength());
log.info("Browsed message: " + msg);
log.info("Actually get message?");
byte b = new byte[message.getMessageLength()];
message.readFully(b);
createDAO rmdao = new createDAO();
rmdao.updateCreate(new String(b),messageID);
log.info(new String(b));
message.clearMessage();
/************************************************/
/* Reset the options to browse the next message */
/************************************************/
getOptions.options= MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_NEXT;
}
Thanks in advance
java ibm-mq
java ibm-mq
edited yesterday
Maxtech
asked Nov 13 '18 at 11:47
MaxtechMaxtech
145
145
In a standard request reply model the message sent would havemessageType
set toMQC.MQMT_REQUEST
and after the put completes you can read the generated message id, ex:msg.messageId
. The the app that replies would normally populate thecorrelationId
of the Reply message with the Request message'smessageId
, when you get the message you can then read the corrlation id, ex:message.correlationId
. In this way you can tie the the request and reply together. If you populate thecorrelationId
before the get MQ will look only for messages with the value you specify.
– JoshMc
Nov 13 '18 at 12:11
Hi, Please correct me as per your answer I need to set msg.messageType = MQC.MQMT_REQUEST instead of msg.messageType = MQC.MQMT_DATAGRAM; second I need to add the below code before get the Message and then store the correrlationId and message to the table. String messageID= dumpHexId(message.messageId); String correlationID = dumpHexId(message.correlationId); String msg = message.readString(message.getMessageLength()); queue.get(message, getOptions); Please correct m
– Maxtech
Nov 13 '18 at 12:33
I assume you would store messageId directly after put and store correlationId directly after get.
– JoshMc
Nov 13 '18 at 12:38
Thanks: I will store the message ID before get and correlation Id after get that way it works correct.
– Maxtech
Nov 13 '18 at 12:41
add a comment |
In a standard request reply model the message sent would havemessageType
set toMQC.MQMT_REQUEST
and after the put completes you can read the generated message id, ex:msg.messageId
. The the app that replies would normally populate thecorrelationId
of the Reply message with the Request message'smessageId
, when you get the message you can then read the corrlation id, ex:message.correlationId
. In this way you can tie the the request and reply together. If you populate thecorrelationId
before the get MQ will look only for messages with the value you specify.
– JoshMc
Nov 13 '18 at 12:11
Hi, Please correct me as per your answer I need to set msg.messageType = MQC.MQMT_REQUEST instead of msg.messageType = MQC.MQMT_DATAGRAM; second I need to add the below code before get the Message and then store the correrlationId and message to the table. String messageID= dumpHexId(message.messageId); String correlationID = dumpHexId(message.correlationId); String msg = message.readString(message.getMessageLength()); queue.get(message, getOptions); Please correct m
– Maxtech
Nov 13 '18 at 12:33
I assume you would store messageId directly after put and store correlationId directly after get.
– JoshMc
Nov 13 '18 at 12:38
Thanks: I will store the message ID before get and correlation Id after get that way it works correct.
– Maxtech
Nov 13 '18 at 12:41
In a standard request reply model the message sent would have
messageType
set to MQC.MQMT_REQUEST
and after the put completes you can read the generated message id, ex: msg.messageId
. The the app that replies would normally populate the correlationId
of the Reply message with the Request message's messageId
, when you get the message you can then read the corrlation id, ex: message.correlationId
. In this way you can tie the the request and reply together. If you populate the correlationId
before the get MQ will look only for messages with the value you specify.– JoshMc
Nov 13 '18 at 12:11
In a standard request reply model the message sent would have
messageType
set to MQC.MQMT_REQUEST
and after the put completes you can read the generated message id, ex: msg.messageId
. The the app that replies would normally populate the correlationId
of the Reply message with the Request message's messageId
, when you get the message you can then read the corrlation id, ex: message.correlationId
. In this way you can tie the the request and reply together. If you populate the correlationId
before the get MQ will look only for messages with the value you specify.– JoshMc
Nov 13 '18 at 12:11
Hi, Please correct me as per your answer I need to set msg.messageType = MQC.MQMT_REQUEST instead of msg.messageType = MQC.MQMT_DATAGRAM; second I need to add the below code before get the Message and then store the correrlationId and message to the table. String messageID= dumpHexId(message.messageId); String correlationID = dumpHexId(message.correlationId); String msg = message.readString(message.getMessageLength()); queue.get(message, getOptions); Please correct m
– Maxtech
Nov 13 '18 at 12:33
Hi, Please correct me as per your answer I need to set msg.messageType = MQC.MQMT_REQUEST instead of msg.messageType = MQC.MQMT_DATAGRAM; second I need to add the below code before get the Message and then store the correrlationId and message to the table. String messageID= dumpHexId(message.messageId); String correlationID = dumpHexId(message.correlationId); String msg = message.readString(message.getMessageLength()); queue.get(message, getOptions); Please correct m
– Maxtech
Nov 13 '18 at 12:33
I assume you would store messageId directly after put and store correlationId directly after get.
– JoshMc
Nov 13 '18 at 12:38
I assume you would store messageId directly after put and store correlationId directly after get.
– JoshMc
Nov 13 '18 at 12:38
Thanks: I will store the message ID before get and correlation Id after get that way it works correct.
– Maxtech
Nov 13 '18 at 12:41
Thanks: I will store the message ID before get and correlation Id after get that way it works correct.
– Maxtech
Nov 13 '18 at 12:41
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280391%2fmq-message-in-the-request-and-reply-store-in-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280391%2fmq-message-in-the-request-and-reply-store-in-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
In a standard request reply model the message sent would have
messageType
set toMQC.MQMT_REQUEST
and after the put completes you can read the generated message id, ex:msg.messageId
. The the app that replies would normally populate thecorrelationId
of the Reply message with the Request message'smessageId
, when you get the message you can then read the corrlation id, ex:message.correlationId
. In this way you can tie the the request and reply together. If you populate thecorrelationId
before the get MQ will look only for messages with the value you specify.– JoshMc
Nov 13 '18 at 12:11
Hi, Please correct me as per your answer I need to set msg.messageType = MQC.MQMT_REQUEST instead of msg.messageType = MQC.MQMT_DATAGRAM; second I need to add the below code before get the Message and then store the correrlationId and message to the table. String messageID= dumpHexId(message.messageId); String correlationID = dumpHexId(message.correlationId); String msg = message.readString(message.getMessageLength()); queue.get(message, getOptions); Please correct m
– Maxtech
Nov 13 '18 at 12:33
I assume you would store messageId directly after put and store correlationId directly after get.
– JoshMc
Nov 13 '18 at 12:38
Thanks: I will store the message ID before get and correlation Id after get that way it works correct.
– Maxtech
Nov 13 '18 at 12:41