dependency-injectionmessage-driven-beandeployment-descriptorejb-jar.xml

Inject a String into a Message Driven Bean


I want to configure the behaviour of one of my mdbs with string. i created a setMessageType method and want to inject the identifier string into the mdb by configuration in the ejb-jar (deployment descriptor).

I know how do declare a bean in the ejb-jar but how do i control dependency injection?

Greetings,

Laures


Solution

  • funny i never go an answer to this questions.

    <message-driven>
        <ejb-name>mymdb</ejb-name>
        <ejb-class>net.something.MyMDBClass</ejb-class>
        <activation-config>
            <activation-config-property>
                <activation-config-property-name>destinationType</activation-config-property-name>
                <activation-config-property-value>javax.jms.Topic</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>destination</activation-config-property-name>
    
                <activation-config-property-value>i.listen.here</activation-config-property-value>
            </activation-config-property>
        </activation-config>
        <env-entry>
            <env-entry-name>MessageType</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>myconfigstring</env-entry-value>
        </env-entry>
    </message-driven>