简体   繁体   English

ActiveMQ Artemis 升级问题:HornetQ 到 Artemis 2.0

[英]ActiveMQ Artemis upgrade question: HornetQ to Artemis 2.0

I have been upgrading an old HornetQ project to Artemis and I ran into some issues with the JMSServerControl .我一直在将旧的 HornetQ 项目升级到 Artemis,但遇到了JMSServerControl一些问题。 My original code looked like this.我的原始代码是这样的。

final ObjectName on = ObjectNameBuilder.DEFAULT.getJMSServerObjectName();
final JMSServerControl sControl = jmxConnectorFactory.newProxyInstance( mbsc, on, JMSServerControl.class, false );
final boolean success = sControl.createQueue( canonicalName, jndiBinding );

I actually upgraded to ActiveMQ Artemis 1.3 first where this code still works.我实际上首先升级到 ActiveMQ Artemis 1.3,此代码仍然有效。 I am planning on going to 2.15.0 eventually, but I just wasn't sure what other things may have been deprecated so I took a smaller jump to 2.0.我计划最终使用 2.15.0,但我不确定还有哪些其他东西可能已被弃用,所以我小幅跳转到 2.0。 The above code broke when I moved to 2.0 so I am using the following.当我移动到 2.0 时,上面的代码中断了,所以我使用了以下代码。

final ObjectName on = ObjectNameBuilder.DEFAULT.getActiveMQServerObjectName();
final ActiveMQServerControl sControl = jmxConnectorFactory.newProxyInstance( mbsc, on, ActiveMQServerControl.class, false );
...

Now createQueue has been deprecated.现在createQueue已被弃用。 Any suggestion of what I could use instead to get the same behavior?关于我可以使用什么来获得相同行为的任何建议?

You should use one of the non-deprecated createQueue methods, ie:您应该使用非弃用的createQueue方法之一,即:

  • org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl#createQueue(java.lang.String)
  • org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl#createQueue(java.lang.String, boolean)

For example:例如:

final ObjectName on = ObjectNameBuilder.DEFAULT.getActiveMQServerObjectName();
final ActiveMQServerControl sControl = jmxConnectorFactory.newProxyInstance( mbsc, on, ActiveMQServerControl.class, false );
sControl.createQueue(new QueueConfiguration(canonicalName).setRoutingType(RoutingType.ANYCAST).toJSON());

This code will create a core queue and a core address with the same name (ie canonicalName ) using the ANYCAST routing-type.此代码将使用ANYCAST路由类型创建一个核心队列和一个具有相同名称(即canonicalName )的核心地址。 This will provide the semantics equivalent to a JMS queue.这将提供等效于 JMS 队列的语义。 I recommend you read the chapter from the documentation about JMS-to-core mapping.我建议您阅读有关 JMS 到核心映射的文档中的章节 That will help you understand more about what configuration you need for the core resources to get the semantics you want for your JMS clients.这将帮助您更多地了解核心资源需要什么配置才能为 JMS 客户端获得所需的语义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM