JMS Destination Resource Registration Issues
jfisherdev Aug 1, 2016 1:10 PMI am writing an extension that will deploy a JMS topic whose name is based on the name of the application being deployed. For example, if an application called myApp.ear is deployed, a topic called "myAppTopic" would be deployed (the appropriate JNDI bindings would be created as well).
I am targeting a standalone WildFly 9.0.2 server with HornetQ.
Although the DeploymentUnitProcessor I am using to do this executes without any issues that halt the deployment process, I have encountered this issue:
The management resource for the destination I would expect to see is not created. For example, using my original example and a hornetq server called "default" I would expect to find a management resource for the destination with this path address: /subsystem=messaging/hornetq-server=default/jms-topic=myAppTopic
However, I do not find a management resource for the destination. It also does not appear in the management console as a destination.
There do appear to be resources in the runtime-queue whose names are in this form: jms.(queue|topic).$destinationName$
Also, I do see the JNDI bindings specified for the destinations deployed by this DeploymentUnitProcessor in the management console under Runtime/Subsystems/JNDI View.
My DeploymentUnitProcessor implementation is modeled after the JMSTopicAdd handler and looks like this:
public class DestinationDeploymentProcessor implements DeploymentUnitProcessor {
public static final Phase PHASE = Phase.DEPENDENCIES;
public static final int PRIORITY = 0x5200;
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
//Value is built from the deploymentUnit name, for example "myAppTopic"
final String topicName = ...;
final String[] jndiBindings = {"java:topic/" + topicName, ...}
final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
final ServiceName hornetQServiceName = MessagingServices.getHornetQServiceName(CommonAttributes.DEFAULT);
// Comment copied from JMSTopicAdd:
// Do not pass the JNDI bindings to HornetQ but install them directly instead so that the
// dependencies from the BinderServices to the JMSQueueService are not broken.
final JMSTopicService jmsTopicService = JMSTopicService.installService(topicName, hornetQServiceName, serviceTarget, new String[0]);
final ServiceName jmsTopicServiceName = JMSServices.getJmsTopicBaseServiceName(hornetQServiceName).append(topicName);
for(String jndiBinding : jndiBindings){
// Comment copied from JMSTopicAdd:
// install a binder service which depends on the JMS topic service
BinderServiceUtil.installBinderService(serviceTarget, jndiBinding, jmsTopicService, jmsTopicServiceName);
}
}
}
Any information on how to solve this issue or even to let me know if this is possible or not would be appreciated.