2017-01-27 1 views
0

Ist es möglich, einen Laufzeitwert für "Ziel" in MDB (Message Driven Bean) dynamisch zuzuweisen?TomEE MDB Message Driven Beans

Die Anmerkung basierten Ansatz Kräfte auf MDB hart codieren

@MessageDriven(name="PingPongMDB", activationConfig = { 
    @ActivationConfigProperty(
      propertyName = "destinationType", 
      propertyValue = "javax.jms.Queue"), 
     @ActivationConfigProperty(
      propertyName = "destination", 
      propertyValue = "ref_fooQueue")}) 
public class PingPongMDB implements MessageListener { 

Ich habe auch versucht die ejb-jar.xml Ansatz, aber Wert für "Aktivierung-config-property-name" = "Ziel" gelesen wird als ein wörtlicher physischer Name der Warteschlange. Daher kann ich keine JNDI-Suche der Ressource durchführen.

<message-driven> 

    <ejb-name>PingPongMDB</ejb-name> 
    <ejb-class>com.company.sample.services.PingPongMDB</ejb-class> 

    <messaging-type>javax.jms.MessageListener</messaging-type> 

    <activation-config> 
    <activation-config-property> 
     <activation-config-property-name>destination</activation-config-property-name> 
     <activation-config-property-value>openejb:Resource/ref_fooQueue</activation-config-property-value> 
    </activation-config-property> 
    <activation-config-property> 
     <activation-config-property-name>destinationType</activation-config-property-name> 
     <activation-config-property-value>javax.jms.Queue</activation-config-property-value> 
    </activation-config-property> 
    </activation-config> 

</message-driven> 

Was ist der richtige Weg, um das Ziel aus Eigenschaften zu lesen und zuzuordnen oder den Wert mit -D-Parametern zu übergeben?

Antwort

Verwandte Themen