您的位置:程序门 -> websphere ->



mq程序设计中,为什么messageid每次产生都是一样的??


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


mq程序设计中,为什么messageid每次产生都是一样的??
发表于:2007-02-28 17:42:23 楼主
mqmessage   msg   =   new   mqmessage   ();  
msg.report   =mqc.mqro_copy_msg_id_to_correl_id;  
mqputmessageoptions   pmo   =   new   mqputmessageoptions   ();  

//set   put   options  
pmo.options   =   mqc.mqpmo_new_msg_id   +   mqc.mqpmo_syncpoint   ;  
msg.characterset   =37;  
try  
{  
msg.writestring(strmsg);  
dataqueue.put(msg,pmo);  
system.out.println( "the   strcorrid   is:   "   +   msg.correlationid.tostring()   );  
system.out.println( "the   strmsgid   is:   "   +   msg.messageid.tostring()   );  
}  
catch(mqexception   mqe)   //if   throws   mqexceptions  
{  
system.err.println( "mq   error   while   connecting   to   queue,   reasoncode   is   "   +   mqe.reasoncode);  
}  
catch(exception   e)  
{  
system.out.println( "error!   "   +   e.tostring());  
}  

为什么每次产生的messageid、correlationid   都是相同的????  

产生的结果如下:  
the   strcorrid   is:   [b@ef22f8  
the   strmsgid   is:   [b@1e0cf70  


有什么地方需要设置吗?还是每次就是产生一样的???

以上代码用java编写的~
发表于:2007-03-08 11:28:551楼 得分:0
问题出在tostring上,你看着它们一样,实际上不一样
发表于:2007-03-18 20:53:042楼 得分:0
个人理解:
其它messageid这一块主要是用来做消息区分的,我工作中主要是用来实现消息同步,messageid应该是不同的,这样取回消息的时候才不会串了。对于我们java编程这一块,messageid可以说是透明的,真实区分是mq自己做的!


快速检索

最新资讯