-
Sub-task
-
Resolution: Unresolved
-
Major
-
2.17.0.Final
It would be good to have a command to quickly add code to allow sending JMS messages. The following command would create the needed code using a message of type String :
jms-add-send-message-method --named sendMessage --destinationType QUEUE --destinationName myQueue
This would inject the javax.jms.JMSContext and add a method to send JMS message :
@Inject JMSContext context; @Resource(mappedName = "myQueue") Queue queue; public void sendMessage(String message) { context.createProducer().send(queue, message); }
To customize the message type, we just use the type parameter :
jms-add-send-message-method --named sendMessage --type MyBean --destinationType QUEUE --destinationName myQueue
We will get the following code :
@Inject JMSContext context; @Resource(mappedName = "myQueue") Queue queue; public void sendMessage(MyBean message) { context.createProducer().send(queue, message); }