JMS JMSCC3032例外

发布于 2025-01-24 19:04:45 字数 2150 浏览 3 评论 0原文

我使用IBM MQ。我将我的应用程序中的com.ibm.mqmq.mq jar从7.5升级到9.1.1.0 as:

<groupId>com.ibm.mq</groupId>
<artifactId>com.ibm.mq.allclient</artifactId> 
<version>9.1.1.0</version>

我正在从主题接收消息的消费者开始获取错误jmscc0111

当我阅读时,这是在8.0版的JMS库中的新行为,默认情况下,JMS ID无法重复使用。 作为解决方案,我将clientId设置为在下面的连接上。我正在从ConnectionFactory获得连接。

public Connection getConnectionWithUuid() throws JMSException {
    Connection connection = connFactory.createConnection();
    String uid = UUID.randomUUID().toString();
    connection.setClientID(uid);
    connection.start();
    return connection;
}

现在,我开始获得异常:

JMSCC3032: Resetting the client ID is not allowed.
Connection jmsConnection = null;
Session jmsSession = null;
MessageConsumer consumer = null;
MessageProducer producer = null;
try {
    jmsConnection = QueueManager.getInstance().getConnectionWithUuid();
    jmsSession = jmsConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    Destination responseTopic = QueueManager.getInstance()
            .getDestination(this.parameters.getResponseTopicName());
    Destination outGoingQueue = QueueManager.getInstance()
            .getDestination(this.parameters.getOutGoingQueueName());
    consumer = jmsSession.createConsumer(responseTopic);
    producer = jmsSession.createProducer(outGoingQueue);
    TextMessage requestMessage = jmsSession.createTextMessage(request);
    requestMessage.setJMSCorrelationID(parameters.getSessionId());
    producer.send(requestMessage);
    logMessage("OutGoing Message:\n", requestMessage);
    String response = null;
    long begin = System.currentTimeMillis();
    while (response == null && System.currentTimeMillis() - begin < protocolTimeoutSecs * 1000) {
        Message responseMessage = consumer.receive(protocolTimeoutSecs * 1000);

在最后一行(computer.receive)上抛出jmscc3032

I use IBM MQ. I upgraded the com.ibm.mq jar in my application from 7.5 to 9.1.1.0 as:

<groupId>com.ibm.mq</groupId>
<artifactId>com.ibm.mq.allclient</artifactId> 
<version>9.1.1.0</version>

My consumer that is receiving messages from topic started to get error JMSCC0111.

As I read this is new behavior in the JMS libraries above version 8.0 where by default a JMS ID can not be reused.
As a solution I set clientId on connection as below. I'm getting connection from ConnectionFactory.

public Connection getConnectionWithUuid() throws JMSException {
    Connection connection = connFactory.createConnection();
    String uid = UUID.randomUUID().toString();
    connection.setClientID(uid);
    connection.start();
    return connection;
}

Now I started to get exception:

JMSCC3032: Resetting the client ID is not allowed.
Connection jmsConnection = null;
Session jmsSession = null;
MessageConsumer consumer = null;
MessageProducer producer = null;
try {
    jmsConnection = QueueManager.getInstance().getConnectionWithUuid();
    jmsSession = jmsConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    Destination responseTopic = QueueManager.getInstance()
            .getDestination(this.parameters.getResponseTopicName());
    Destination outGoingQueue = QueueManager.getInstance()
            .getDestination(this.parameters.getOutGoingQueueName());
    consumer = jmsSession.createConsumer(responseTopic);
    producer = jmsSession.createProducer(outGoingQueue);
    TextMessage requestMessage = jmsSession.createTextMessage(request);
    requestMessage.setJMSCorrelationID(parameters.getSessionId());
    producer.send(requestMessage);
    logMessage("OutGoing Message:\n", requestMessage);
    String response = null;
    long begin = System.currentTimeMillis();
    while (response == null && System.currentTimeMillis() - begin < protocolTimeoutSecs * 1000) {
        Message responseMessage = consumer.receive(protocolTimeoutSecs * 1000);

On the last line (consumer.receive) it throws JMSCC3032.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文