[jboss-user] [EJB 3.0] - Re: Extensions to EJB3: Message Driven POJOs
FrJaSoBe
do-not-reply at jboss.com
Thu Jan 25 06:22:30 EST 2007
Hi,
I have use @MessageDriven with no problem but when I have tried to use @Producer and @Consumer, I think I can't refactorize method start in that code(we filtrate message and add a listener):
...
@MessageDriven(mappedName = "queue/CentralitaInQueue", activationConfig = {
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/CentralitaInQueue"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
}
)
public class ConectorJBoss extends Conector implements MessageListener {
...
public void onMessage(Message message) {
ObjectMessage objMessage = (ObjectMessage) message;
try {
ApduCentralita apdu = (ApduCentralita) objMessage.getObject();
super.enviarComando(apdu);
} catch (JMSException e) {
Log.getLogger(this).error(e);
}
}
...
public void start() {
try {
//se crea el jmsworker
//jmsworker = new JMSWorker(null, JMSWorker.TIPO_LOCAL);
jmsworker = new JMSWorker(Constantes.CONNECTION_FACTORY_CENTRALITAS);
//jmsworker = new JMSWorker(this.queueConnectionFactory, this.topicConnectionFactory);
//selector jms para que solo tome los comandos que le corresponden
String selector = SELECTOR_JMS_CENTRALITA.replaceAll("\\#host_centralita", inetSockAddr.getAddress().getHostAddress());
selector = selector.replaceAll("\\#puerto_centralita", new Integer(inetSockAddr.getPort()).toString());
//anyadirse a si mismo como listener de la queue de comandos
jmsworker.receiverQueue(Constantes.QUEUE_CENTRALITAS_COMANDOS, this, selector);
//jmsworker.receiverQueue(this.queue, this, selector);
//se inicializa y cachea el publisher que se utilizara para enviar eventos a la cola de eventos
jmsworker.openCachedPublisher(Constantes.TOPIC_CENTRALITAS_EVENTOS);
//jmsworker.openCachedPublisher(this.topic);
} catch (Exception e) {
Log.getLogger(this).error(e);
}
}
...
}
Can I do this with JBoss Extension for MDB ?
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4006283#4006283
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4006283
More information about the jboss-user
mailing list