Vor ein paar Tagen hatte ich ein interessantes Problem: bei JBoss 4 war es sehr einfach, Queues für MDBs zu erzeugen. Einfach destination und destinationType in die @ActivationConfigProperty eintragen und beim Deployment werden werden die Queues automatisch erzeugt. Leider ist das bei JBoss 5 nicht mehr ganz so einfach. Der Trick ist, in der jboss.xml das Tagtruehinzuzufügen und auf die entsprechende EJB und die anzulegende Queue zu verweisen (die jboss.xml liegt im META-INF-Verzeichnis). Im Ganzen sieht das folgendermaßen aus:
<?xml version="1.0" encoding="UTF-8"?>
<jboss xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
version="3.0">
<enterprise-beans>
<message-driven>
<ejb-name>QueueCreateMDB</ejb-name>
<destination-jndi-name>queue/myQueue</destination-jndi-name>
<create-destination>true</create-destination>
</message-driven>
</enterprise-beans>
</jboss>
Die dazu passende MessageBrivenBean sieht so aus:
@MessageDriven(name="QueueCreateMDB", activationConfig={
@javax.ejb.ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
@javax.ejb.ActivationConfigProperty(propertyName="destination", propertyValue="queue/myQueue"),
@javax.ejb.ActivationConfigProperty(propertyName="useDLQ", propertyValue="false"),
@javax.ejb.ActivationConfigProperty(propertyName="acknowledgeMode", propertyValue="Auto-acknowledge")},
messageListenerInterface=MessageListener.class)
public class QueueCreateMDB implements MessageListener {
Dadurch wird beim Deployment die angegebene Queue angelegt.

