|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
My program dont receive message with specific CORRELID |
« View previous topic :: View next topic » |
Author |
Message
|
alexassis |
Posted: Fri Dec 10, 2004 8:58 am Post subject: My program dont receive message with specific CORRELID |
|
|
 Newbie
Joined: 10 Dec 2004 Posts: 6
|
I have a problem with the program written in Java, where the message is recouped through the CORRELID. I read the manual "Using Java", of IBM, and I followed all the described steps, to put I did not get the waited result.
The platform of origin of the message is the Linux (Red Hat), e the version of the MQSeries is 5.3. The message is sent to host (OS390 v2.10), active e a transaction in the IMS using the MQ-IMS Bridge. In the return message the MSGID returns in field CORRELID.
It follows below the stretch of the program, e a stretch of log I before contend information of MSGID and CORRELID and after the writing and reading of the message.
----------------- Source Program ------------------
import com.ibm.mq.*;
import java.io.*;
import java.util.*;
import java.text.*;
public class Servicos_MQ_UBB {
// Parametros e Variaveis de Filas
private String nomeGerenciadorFilas = "DES.HIPERCARD.01";
private String nomeFilaPUT = "F_ICR_SOLICITA_CONSULTA_HC";
private String nomeFilaGET = "F_ICR_RESPOSTA_CONSULTA_HC";
private String nomeFilaRESPOSTA = "F_ICR_RESP_ATIVA_HIPERCARD";
private String mensagemErro = "";
private String BUFFER_SAIDA_MQ = "";
private String nomeFilaPUTC = "F_ICR_SOLICITA_CANCELA_HC";
private String nomeFilaGETC = "F_ICR_RESPOSTA_CANCELA_HC";
private String nomeFilaPUTP = "F_ICR_PESQUISA_STATUS_PROPOSTA_HC";
private String nomeFilaGETP = "F_ICR_RESPOSTA_PESQUISA_STATUS_PROPOSTA_HC";
// Variaveis de Trace
private boolean traceLog = false;
private String traceFile = "/opt/XseedApp/DBSIC/Log/Servicos_MQ_UBB.log";
private SimpleDateFormat formato = null;
private byte[] correlId;
private byte[] msgId;
public Servicos_MQ_UBB()
{
formato = new SimpleDateFormat();
formato.applyPattern("dd/MM/yyyy hh:mm:ss");
}
public boolean processaTransacao (String BUFFER_ENTRADA_MQ)
{
MQQueueManager gerenciadorFilas = null;
MQQueue filaGET = null;
try
{
mensagemErro = "";
BUFFER_SAIDA_MQ = "";
gerenciadorFilas = new MQQueueManager( nomeGerenciadorFilas );
// Ajusta opcoes fila PUT
int opcoesFilaPUT = MQC.MQOO_OUTPUT +
MQC.MQOO_FAIL_IF_QUIESCING +
MQC.MQOO_SET_IDENTITY_CONTEXT ;
// Abrir fila PUT
MQQueue filaPUT = gerenciadorFilas.accessQueue ( nomeFilaPUT, opcoesFilaPUT, null, null, null );
// Prepara Mensagem de ENVIO
MQMessage mensagemPUT = new MQMessage ();
// montar header bridge
clsMQBridgeIMS montaMSG = new clsMQBridgeIMS ();
// Ajusta opcoes mensagem PUT
MQPutMessageOptions opcoesPUT = new MQPutMessageOptions();
mensagemPUT.format = MQC.MQFMT_IMS;
mensagemPUT.messageType = MQC.MQMT_REQUEST;
mensagemPUT.userId = "userid";
mensagemPUT.report = MQC.MQRO_NEW_MSG_ID +
MQC.MQRO_COPY_MSG_ID_TO_CORREL_ID;
// Amarrar a fila de PUT com a GET.
mensagemPUT.replyToQueueName = nomeFilaGET;
mensagemPUT = montaMSG.monta (mensagemPUT, BUFFER_ENTRADA_MQ.length() + 9);
// montar mensagem MQ
mensagemPUT.writeString ("imstran ");
mensagemPUT.writeString (BUFFER_ENTRADA_MQ);
opcoesPUT.options = MQC.MQPMO_SET_IDENTITY_CONTEXT +
MQC.MQPMO_FAIL_IF_QUIESCING;
mensagemPUT.messageId = MQC.MQMI_NONE;
mensagemPUT.correlationId = MQC.MQCI_NONE;
filaPUT.put( mensagemPUT, opcoesPUT );
// Salvar o identificador do PUT para o identificador do GET
correlId = mensagemPUT.correlationId;
msgId = mensagemPUT.messageId;
// Fechar fila PUT - Bridge
filaPUT.close();
// Ajusta opcoes fila GET
int opcoesFilaGET = MQC.MQOO_INPUT_SHARED +
MQC.MQOO_FAIL_IF_QUIESCING ;
filaGET = gerenciadorFilas.accessQueue ( nomeFilaGET, opcoesFilaGET, null, null, null );
clsMQBridgeIMS desmontaMSG = new clsMQBridgeIMS ();
MQMessage mensagemGET = new MQMessage ();
// Busca na fila a mensagems GET relacionada àquela mensagem PUT postada anteriormente.
mensagemGET.resizeBuffer(6653);
MQGetMessageOptions opcoesGET = new MQGetMessageOptions();
opcoesGET.options = MQC.MQGMO_WAIT +
MQC.MQGMO_CONVERT +
MQC.MQGMO_NO_SYNCPOINT +
MQC.MQGMO_FAIL_IF_QUIESCING;
opcoesGET.waitInterval = 30000;
mensagemGET.messageType = MQC.MQMT_REPLY;
// Mover o identificador do PUT para o identificador do GET
mensagemGET.messageId = MQC.MQMI_NONE;
mensagemGET.correlationId = msgId;
opcoesGET.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
filaGET.get( mensagemGET, opcoesGET );
.
.
.
.
.
----------------- Log data ------------------
- Before MQPUT, initialize field’s with MQMI_NONE and MQCI_NONE:
PUT Msg Id : [B@126d3df
PUT Msg correlId : [B@1a1c42f
- After MQPUT:
PUT Msg Id : [B@b6d6ab
PUT Msg correlId: [B@1c7865b
- Before MQGET, initialize CORRELID with MSGID of MQPUT
GET Msg Id A : [B@126d3df
GET Msg CorrelId : [B@b6d6ab
- After MQGET
GET Msg Id : [B@e22f2b
GET Msg CorrelId : [B@186dda3
Thank's
ALEX |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Dec 10, 2004 9:19 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Okay.
What your print statements are displaying is the address of the byte array, not the contents.
So if they are different, that may not be a problem.
Try
Code: |
System.out.println(new String(msgId)); |
for example. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|