[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4137
  • Last Modified:

MDB (ejb3) in JBoss with WebSphere MQ

Hi,
Our MDB already work in our JBoss server, our problem is that the server address/port are specified in ActivationConfigProperty annotation, so it's not configurable. The queue is retrieve from the JNDI, but i cannot specify the ConnectionFactory as a JNDI ressource...

I`ve already try an annotation like:
@ActivationConfigProperty(propertyName="connectionFactoryName", propertyValue="jms/factory")

Result: No property found for: connectionFactoryName on JavaBean: javax.jms.Queue:jms/request@@localhost)

From what i read, i have very little hope to resolve this issue.

JBoss version: jboss-4.2.3.GA
Websphere MQ: 6.xx


MDB Code:
 
@MessageDriven(name="RequestListener", activationConfig = {
	    @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
	    @ActivationConfigProperty(propertyName="destination", propertyValue="jms/request"),
	    @ActivationConfigProperty(propertyName="useJNDI", propertyValue="true"),
	    @ActivationConfigProperty(propertyName="hostName", propertyValue="192.168.1.12"),
	    @ActivationConfigProperty(propertyName="port", propertyValue="1420")
	})
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class RequestListener implements MessageDrivenBean, MessageListener {
 
 
 
Queue MBean:
 
	<!-- mbeans defining JCA administered objects -->
	<mbean code="org.jboss.resource.deployment.AdminObject"
		name="jca.wmq:name=jmsRequest">
		<attribute name="JNDIName">jms/request</attribute>
		<depends optional-attribute-name="RARName">
			jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
		</depends>
		<attribute name="Type">javax.jms.Queue</attribute>
		<attribute name="Properties">
			baseQueueName=REQUEST
			targetClient=JMS
		</attribute>
	</mbean>
 
 
 
Connection Factory
 
  <!-- JCA Connection factory definitions -->
  <tx-connection-factory>
    <jndi-name>jms/factory</jndi-name>
    <xa-transaction />
    <rar-name>wmq.jmsra.rar</rar-name>
   <connection-definition>javax.jms.ConnectionFactory</connection-definition>
      <config-property name="queueManager" type="java.lang.String">MGT0</config-property>
      <config-property name="hostName" type="java.lang.String">192.168.1.12</config-property>
      <config-property name="port" type="java.lang.String">1420</config-property>
      <config-property name="transportType" type="java.lang.String">CLIENT</config-property>
  </tx-connection-factory>

Open in new window

0
Kobold
Asked:
Kobold
1 Solution
 
KoboldAuthor Commented:
I finally found something:

edit ra.xml from wmq.jmsra.rar/META-INF,  replace com.ibm.mq.connector.inbound.ActivationSpecImpl with
a custom class that extends it.

Package that class in a .jar and place it in the same directory than  wmq.jmsra.rar.

Your impl can get its parameters from a .xml, env properties or anything else.

this is a patch, but i didnt find anything else...
public class DynamicActivationSpecImpl extends ActivationSpecImpl {
 
	/**
	 * 
	 */
	public DynamicActivationSpecImpl() {
		setHostName("10.10.1.17");
		setPort(1420);
		setUseJNDI(true);
	}
}

Open in new window

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now