[jboss-user] [EJB3] - Re: JB 6 CR1: @MessageDriven deployment cleanup issue
Christian Tre
do-not-reply at jboss.com
Thu Dec 9 03:43:41 EST 2010
Christian Tre [http://community.jboss.org/people/RET] created the discussion
"Re: JB 6 CR1: @MessageDriven deployment cleanup issue"
To view the discussion, visit: http://community.jboss.org/message/575094#575094
--------------------------------------------------------------
sample code:
import java.util.concurrent.atomic.AtomicInteger;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@MessageDriven(mappedName = "WrapperJMS",
activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
// deploy and redeploy with following line
//, at ActivationConfigProperty(propertyName="destination", propertyValue="queue/WrapperJMS")
})
public class MessageReceiver implements MessageListener {
private static final Log LOG = LogFactory.getLog(MessageReceiver.class);
private static AtomicInteger messagecount = new AtomicInteger();
/**
* Default constructor.
*/
public MessageReceiver() {
if (LOG.isDebugEnabled()) {
LOG.debug("init MessageReceiver");
}
}
/**
* @see MessageListener#onMessage(Message)
*/
@Override
public void onMessage(Message message) {
if (message == null) {
if (LOG.isErrorEnabled()) {
LOG.error("kann Nachricht nicht verarbeiten, da sie NULL ist!");
}
return;
}
try {
final String ID = message.getJMSMessageID();
final int PRIORITY = message.getJMSPriority();
final String REFID = message.getJMSCorrelationID();
if (LOG.isDebugEnabled()) {
LOG.debug("Message #" + messagecount.incrementAndGet() + ": ID=" + ID + ", Priority=" + PRIORITY + ", RefID=" + REFID);
}
try {Thread.sleep(5000);} catch (InterruptedException e) {e.printStackTrace();}
} catch (JMSException e) {
e.printStackTrace();
}
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/575094#575094]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101209/a8b93bbe/attachment.html
More information about the jboss-user
mailing list