[jboss-user] [Messaging, JMS & JBossMQ] - MDB creates itself several times

gilcesaravila do-not-reply at jboss.com
Sat Jun 2 11:02:51 EDT 2007


When a jms client send several messages for the MDB in JBoss, this MDB creates itself several times.

@MessageDriven(mappedName = "jms/Server", activationConfig =  {
        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
    })
        
/**Server class*/        
public class Server implements MessageListener {
    public Server() {
        System.out.println("INITIALIZED SERVER!");
    }
    public void onMessage(Message message) {
        System.out.println("Message arrived");
    }
}

/**Client class*/

public class Client {
...
    public Client() {
        try {
...
            QueueSender sender = queSession.createSender(queue);
            TextMessage message = session.createTextMessage("HELLO");
...
//In this point the client sends several messages
            for(int i=0; i<10; i++){
                sender.send(message);
            }
        }catch(Exception ex){System.out.println(ex.getMessage());}
    }
    public static void main(String args[]){
        new Client();
    }
}

The jboss logger show this:

11:11:16,372 INFO  [STDOUT] INITIALIZED SERVER!
11:11:16,382 INFO  [STDOUT] INITIALIZED SERVER!
11:11:16,382 INFO  [STDOUT] Message arrived
11:11:16,382 INFO  [STDOUT] INITIALIZED SERVER!
11:11:16,382 INFO  [STDOUT] Message arrived
11:11:16,382 INFO  [STDOUT] INITIALIZED SERVER!
11:11:16,382 INFO  [STDOUT] Message arrived
11:11:16,382 INFO  [STDOUT] INITIALIZED SERVER!
11:11:16,382 INFO  [STDOUT] Message arrived
11:11:16,392 INFO  [STDOUT] Message arrived
11:11:16,392 INFO  [STDOUT] INITIALIZED SERVER!
11:11:16,392 INFO  [STDOUT] Message arrived
11:11:16,392 INFO  [STDOUT] INITIALIZED SERVER!
11:11:16,392 INFO  [STDOUT] Message arrived
11:11:16,432 INFO  [STDOUT] Message arrived
11:11:16,432 INFO  [STDOUT] Message arrived
11:11:16,493 INFO  [STDOUT] Message arrived

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050675#4050675

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050675



More information about the jboss-user mailing list