我有一个使用javax.jms *类的java程序将消息发布到MQ主题(MQv7.5),很少有消息进入DLQ,DLQ Header中有以下详细信息,
格式'无格式'原因'3023' - > 3023 0x00000bcf MQRCCF_MD_FORMAT_ERROR
Header Info in Message:
DeadLetter Header Information
Encoding 'Default Encoding'
Character Set 'ibm1208'
Format 'No Format'
Reason '3023'
Destination Queue Manager 'QMGRSTCRT1'
Destination Queue ' '
Put Appl Name 'WebSphere MQ Client for Java'
Put Appl Type 'Java'
Date/Time '20150127-19271043'
RFH Header Information
Encoding 'Default Encoding'
Character Set 'ibm1208'
Flags '0'
Format 'No Format'
Name Value Pair 'UNIQUE_CONNECTION_ID', '414D512045414D51534331202020202054B921242739A302 MQPSCommand Publish MQPSTopic CUSTOMER_EVENT MQPSPubOpts NoReg '
MQMD
Put Date 'Tue Jan 07 13:38:44 CST 2015'
Message ID: '414D512045414D51534331202020202054B9212427896148'
Correlation ID: '414D512045414D515343312020202020542907882CEF7E04'
Group ID: '000000000000000000000000000000000000000000000000'
Account Token: '0000000000000000000000000000000000000000000000000000000000000000'
AppID Data: ' '
App Origin Data: ' '
Backout Count: '0'
Character Set: 'ibm1208'
Expiry: '14'
Format: 'RFH version 1'
Encoding: 'Default Encoding'
Feedback: 'None'
Message Flags: 'None'
Offset: '0'
Sequence Number: '1'
Type: 'Datagram'
Persistence: 'Not Persistent'
Priority: '4'
Put Appl Name: 'QMGRSTCRT1 '
Put Appl Type: '26'
Reply To Queue Manager: 'QMGRSTCRT1 '
Reply To Queue Name: ' '
Report: 'Default Report Options, New Msg ID, Copy Msg ID to Correlation ID, Dead Letter Q'
User ID: 'tempid '
Version: '2'
Content Type: 'writestring'
JMS properties
JMSDeliveryMode 2
JMSDestination topic://CUSTOMER_EVENT
JMSTimestamp 1422387524491
mcd.Msd jms_object
JMSExpiration 1422391124491
添加与DLQ消息对应的Qmgr日志 .
AMQ5882: WebSphere MQ Publish/Subscribe broker has written a message to the
dead-letter queue.
EXPLANATION:
The broker has written a message to the dead-letter queue
(SYSTEM.DEADLETTER.QUEUE ) for reason
'3023:MQRCCF_MD_FORMAT_ERROR'. Note. To save log space, after the first
occurrence of this message for stream (TEST.PUBSUB
), it will only be written periodically.
ACTION:
If the message was not deliberately written to the dead-letter queue, for
example by a message broker exit, determine why the message was written to the
dead-letter queue, and resolve the problem that is preventing the message from
being sent to its destination.
程序中使用的代码片段..
private TopicConnection topicConnection = null;
private TopicSession topicSession = null;
private TopicPublisher topicPub = null ;
private TopicSubscriber topicSub = null ;
protected void createTopicPub(String clientID,long msgLifeTime)抛出JMSException {closeTopicPub();
if (topicSession == null)
createTopicConnectionWithClientID(clientID);
Topic the_topic = (Topic)topicSession.createTopic(topicName);
topicPub = topicSession.createPub(the_topic);
topicPub.setDeliveryMode(DeliveryMode.PERSISTENT);
topicPub.setPriority(4);
//SET the time to expire the message
topicPub.setTimeToLive(msgLife);
topicConnection.start();
}
public void sendMessage(String msg) throws JMSException {
TextMessage message = null ;
if (topicPub == null) {
throw new JMSException("TopicPub is null");
}
message = topicSession.createTextMessage(msg);
topicPub.publish(message);
log.debug("Message sent");
}
private void createTopicConnWithClientID(String clientID) throws JMSException {
closeTopicConnection();
MQTopicConnectionFactory topicCF = new MQTopicConnectionFactory();
topicCF.setHostName(hostName);
topicCF.setPort(portNumber);
topicCF.setQueueManager(queueManager);
topicCF.setChannel(channel);
topicCF.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
// create connection and session
topicConnection = topicCF.createTopicConnection();
topicConnection.setClientID(clientID);
topicSession = topicConnection.createTopicSession(transactional,Session.AUTO_ACKNOWLEDGE);
}
什么导致MD格式错误?需要更正的地方在哪里?
1 回答
此错误代码MQRCCF_MD_FORMAT_ERROR表示消息的MQMD格式字段的值不是
MQFMT_ADMIN
.期望通过Format =
MQFMT_ADMIN
给出IBM MQ的各个部分: -Command Server
排队的Pub / Sub
从提供的AMQERR01.LOG错误消息中我们可以看到有问题的功能是Queued Pub / Sub代理 .
由于您需要使用排队的pub / sub,因此您可以直接使用这些主题 . 您说您的应用程序是Java,但不提及它是否是JMS . 使用排队的pub / sub与直接使用主题是在JMS的封面下进行的,因此您可能不知道自己正在这样做 . 检查
PROVIDERVERSION
是否设置为7而不是6 .