Accessing OpenMQ remotely

心不动则不痛 提交于 2019-12-06 07:22:45
Alex Corvino

In all of my digging I haven't found anything to indicate that OpenMQ supplies a JNDI provider when it's used stand alone. It looks like that's provided by GlassFish. This means you'll need to use something like LDAP as an object store, which I haven't done yet.

Currently I've "cheated" by copying the .binding file (the one that's in c:\objectstore in your case) over to a filesystem that JMeter can see so I could reference it. As long as you use actual machine names, or IPs, instead of localhost that'll work but it's obviously not going to cut it for production.

On the Java side you could just drop JNDI completely and just instantiate com.sun.messaging.ConnectionFactory directly. I used Spring to inject the connection factory. Note that I had to include my own a very simple OpenMQConnectionFactoryFactory (stolen from https://wikis.oracle.com/display/GlassFish/OpenMQSpringConnectionConsumer) because com.sun.messaging.ConnectionFactory isn't a bean.

<bean id="connectionfactoryfactory"
class="myownlibrary.messaging.factory.OpenMQConnectionFactoryFactory">
  <property name="properties">
      <props>
          <prop key="imqAddressList">qa29-vm:7676</prop>
          <prop key="imqAddressList">qa30-vm:7676</prop>
          <prop key="imqReconnectAttempts">-1</prop>          
      </props>
  </property>
</bean>

<bean id="connectionfactory"
 factory-bean="connectionfactoryfactory"
 factory-method="constructConnectionFactory"/>

<bean id="jmsFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
    <property name="targetConnectionFactory" ref="connectionfactory" />
</bean>

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!