I am pretty new to JavaEE and I try to build a messaging system using jms and mdb. I want to do the following: - a server for handling messages which is realized by a mdb - different clients who should communicate - clients should just communicate over the server and not directly
So nothing special. I've read a lot in the documentations and tutorials of oracle and I am still confused about some things (although it is working).
1.Message driven beans: In the @MessageDriven annotations it is possible to configure the bean with @ActivationConfigProperty annotations, eg:
@MessageDriven(mappedName = "myBean", activationConfig = {
@ActivationConfigProperty(propertyName = "messageSelector",
propertyValue = "requestType = 'reqA' OR requestType = 'reqB'"),
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue")})
But how do I "create" the queue for this bean? I miss something here I think..
2.For the clients I use managed beans. Clients are able to send and receive, therefore they need a queue or a topic. I create the queue in the clients with
@Resource(name = "clientQueue")
private Queue clientQueue;
and get the queue from the mdb with
@Resource(mappedName = "serverBean")
private Queue serverQueue;
In the mdb I get the queue from the client with
@Resource(name = "clientQueue")
private Queue clientQueue;
Is that correct or is there a better solution?
I know that this is very basic but I am confused because e.g. the tutorial form apache tomcat has some differences to the tutorial from oracle which I do not get.
I confused myself a bit so any clarification would be very nice!