We have a MDB listening to a Queue reading data and sending data to another Queue
@MessageDriven(
activationConfig = { @ActivationConfigProperty(
propertyName = "destinationType", propertyValue = "javax.jms.Queue"
) },
mappedName = "jms/dataQ")
public class DataMDB implements MessageListener {
@Resource(name="jms/dataQueueConnectionFactory")
private ConnectionFactory connectionfactory;
@Resource(name="jms/dataDestinationQ")
private Destination destination;
...
}
and an XML (ibm-ejb-jar-bnd.xml) with bean configuration
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ejb-jar-bnd_1_0.xsd"
version="1.0">
<message-driven name="DataMDB">
<jca-adapter activation-spec-binding-name="eis/dataListenerMDB"
destination-binding-name="jms/dataQ" />
<resource-ref name="jms/dataQueueConnectionFactory"
binding-name="jms/dataQueueConnectionFactory" />
<resource-env-ref name="jms/dataDestinationQ"
binding-name="jms/dataDestinationQ" />
</message-driven>
</ejb-jar-bnd>
and Activation specification for this MDB on WebSphere
As I have seen the examples over Google, this is the typical example of MDB and WAS Activation setup.
We have a problem here as all the JNDI names seen here are hardcoded in Java code anotations as well as in the ibm-ejb-jar-bnd.xml file.
So is there a way that these JNDI names can be brought outside the EJB project, so we could build one project for all customers and customers are free to have their Standard JNDI Names.
Else we have to build different .ear for each customer and which is not ideal.
Thanks in advance people. Any ideas are welcome.
Target Resource JNDI name Specifies the Java Naming and Directory Interface (JNDI) name of the enterprise bean. This is a data entry field. To modify the JNDI name bound to this bean, type the new name in this field, then select OK.
In the Administration COnsole of WAS 7, on the Applications > Application Types > WebSphere enterprise applications > application > EJB JNDI names section, I have a table with four columns : EJB Module (e.g. ProjectEJB. jar)
A JMS activation specification is associated with one or more message-driven beans and provides the configuration necessary for them to receive messages.
All values defined in the ibm-ejb-jar-bnd.xml
maps references to the actual JNDI names. This can be overridden for each of your customers during application installation (mapping references to JNDI names steps in the admin console), after application installation, or during installation using scripts.
The binding file (ibm-ejb-jar-bnd.xml) provides only 'default names', in case you dont want to change them during installation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With