Externalize MDB Configuration - Wildfly 8.2.1 + TIBCO

122 views
Skip to first unread message

Rodrigo Graciano

unread,
Jun 15, 2017, 1:51:09 PM6/15/17
to Generic JMS JCA Resource Adapter for JBoss AS
Hello everyone,

Does anyone knows how I can externalize my MDB configuration to consume messages from TIBCO.
I have the following on my config on my code

@MessageDriven(name = "TibcoListenerBean", activationConfig = {
@ActivationConfigProperty(propertyName = "jndiParameters", propertyValue = "java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory;java.naming.provider.url=tibjmsnaming://abc.my.com:7222;java.naming.factory.url.pkgs=com.tibco.tibjms.naming;org.jboss.as.naming.lookup.by.string=true"),
@ActivationConfigProperty(propertyName = "connectionFactory", propertyValue = "TopicConnectionFactory"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "MY.TOPIC.NAME"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")})

@ResourceAdapter("tibcoResourceAdapter")
public class MyListenerBean implements MessageListener{



That works fine. But if I need to run the code local/dev/stage/prod I always have to update the provider url.
Is there a way to externalize these configurations?
Something like:

Enter code here..@MessageDriven(name = "TibcoListenerBean", activationConfig = {
@ActivationConfigProperty(propertyName = "jndiParameters", propertyValue = "java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory;java.naming.provider.url={PROVIDER.URL};java.naming.factory.url.pkgs=com.tibco.tibjms.naming;org.jboss.as.naming.lookup.by.string=true"),
@ActivationConfigProperty(propertyName = "connectionFactory", propertyValue = "TopicConnectionFactory"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = {TOPIC.NAME}),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")}).

Thank you

Justin Bertram

unread,
Jun 15, 2017, 2:12:54 PM6/15/17
to Generic JMS JCA Resource Adapter for JBoss AS
That's really more of a question for those who support the application server.  What application server you using?

Rodrigo Graciano

unread,
Jun 15, 2017, 2:14:10 PM6/15/17
to Generic JMS JCA Resource Adapter for JBoss AS
Wildfly 8.2.1.Final

Justin Bertram

unread,
Jun 15, 2017, 2:46:34 PM6/15/17
to Generic JMS JCA Resource Adapter for JBoss AS
Search for the "annotation-property-replacement" Wildfly configuration property.  That should give you the information you need.

Rodrigo Graciano

unread,
Jun 15, 2017, 2:54:36 PM6/15/17
to Generic JMS JCA Resource Adapter for JBoss AS
thank you Justin

Rodrigo Graciano

unread,
Jun 27, 2017, 10:27:13 AM6/27/17
to Generic JMS JCA Resource Adapter for JBoss AS
I just wanna explain how I accomplish it. It could help others.
I tested on Wildfly 8.1.0.Final and 8.2.1.Final

On your standalone-full.xml add:
In the beginning of the file, between extensions and management add your jndi properties as:

<system-properties>
    <property name="property.tibjms.jndiParameters" value="java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory;java.naming.provider.url=tibjmsnaming://tibcoServer:tibcoPort;java.naming.factory.url.pkgs=com.tibco.tibjms.naming;org.jboss.as.naming.lookup.by.string=true"/>
</system-properties>


Inside ee subsystem ( i.e. <subsystem xmlns="urn:jboss:domain:ee:2.0">), add:

<spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>  =>this line might be at the file already
<annotation-property-replacement>true</annotation-property-replacement>
<jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>



On your MDB you will make a reference to this property

@MessageDriven(name = "MyListenerBean", activationConfig = {
@ActivationConfigProperty(propertyName = "jndiParameters", propertyValue = "${property.tibjms.jndiParameters}"),


Justin Bertram

unread,
Jun 27, 2017, 10:40:23 AM6/27/17
to Generic JMS JCA Resource Adapter for JBoss AS
Thanks for following up.  This looks like a very simple, effective solution.
Reply all
Reply to author
Forward
0 new messages