当我从非持久主题订阅者切换到持久主题订阅者时,我无法查找之前可以阅读的主题名称(使用 JNDI)。
当正在查找主题时,它会在管理控制台中出现错误:
An error occurred during activation of changes, please see the log for details.
ERROR: Could not activate itft-jmsmodule!ITFT-JMS-1@ItftTopic
The Messaging Kernel ITFT-JMS-1 has not yet been opened
我正在使用 Oracle WebLogic Server 管理控制台来设置 WebSphere 队列。在控制台上,我进行了以下更改:
- 对于持久存储,在配置选项卡上,添加了一个名为的文件存储
ItftFileStore
- 对于持久存储,在配置选项卡上,添加了一个目录。
- 对于 JMS 服务器,在 Configuration -> General 选项卡上,将 Persistent Store 更改为
ItftFileStore
- 对于 JMS 服务器,在配置 -> 常规选项卡 -> 高级中,选中该
Store Enabled
字段。 - 对于 ItftTopic,配置 -> 覆盖选项卡,更改
Delivery Mode Override
为Persistent
.
这是我正在运行的代码。对相关行有一些评论。
public void start() throws Exception {
try {
LOG.info("Starting the FC MQ message consumer / listener ...");
InitialContext initialContext = getInitialContext();
topicConnectionFactory = (TopicConnectionFactory) initialContext.lookup(jmsFactory);
topicConnection = topicConnectionFactory.createTopicConnection();
topicConnection.setClientID(clientId);
LOG.info("1"+topicConnection.getClientID());
topicSession = topicConnection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE);
LOG.info("2"+topicConnection.getClientID());
//topicConnection.setExceptionListener(connectionExceptionListener);
jmsTopic = (Topic) initialContext.lookup(topic); // Error being thrown here
LOG.info("3"+topicConnection.getClientID());
//topicSubscriber = topicSession.createSubscriber(jmsTopic); // Works as a non-durable subscriber
topicSession.createDurableSubscriber(jmsTopic,subscriberName);
LOG.info("4"+topicConnection.getClientID());
topicSubscriber.setMessageListener(messageListener);
topicConnection.start();