Search code examples
deploymentejbwebsphere-8message-driven-bean

How to connect message-driven bean to WebSphere MQ queue without activation specification or listener port


My message-driven bean:

@MessageDriven(
    activationConfig = { @ActivationConfigProperty(
            propertyName = "destination",     propertyValue = "jms/mytestqueue"), @ActivationConfigProperty(
            propertyName = "destinationType", propertyValue = "javax.jms.Queue")
    })
public class MessageQueueInputBean implements MessageListener {
    @Override
    public void onMessage(Message msg) {

is located in a web application

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>Test WebApp</display-name>

My goal is to connect the MDB to a MQ queue and a MQ connection factory. However, in this constellation I only got the dreaded message

REQUIRED_BINDING_NOT_FOUND for MDB

when deploying it on a WebSphere 8.5.5.

Therefore I created file ibm-ejb-jar-bnd.xml, which causes the deployment to succeed:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar-bnd xmlns="http://websphere.ibm.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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="MessageQueueGuidewireBatchInputBean">
        <jca-adapter activation-spec-binding-name="jms/myTestActivationSpecification" />
    </message-driven>
</ejb-jar-bnd>

Apparently this configuration only allows jca-adapter, which refers to an "activation specification" in the WAS, or a listener port.

My problem is that as far as I know, in the target system (maintained by people from a different company) there is no activation specification. There is a queue and a connection factory instead.

Is it possible to deploy the MDB referring to queue and connection factory only?


Solution

  • No. You're not just connecting to an endpoint. You're also hooking into a thread pool, the threads of which will be used to dispatch your MDBs (with all the normal qualities of service and APIs available). That's why you need the extra construct of the activation spec or listener port.