message-driven-bean

Configuring MappedName annotation in Message Driven Bean dynamically

时光总嘲笑我的痴心妄想 提交于 2019-12-22 05:19:16
问题 When using Message Driven BEans, the destination name from where to receive messages is hard coded in the annotation @MessageDriven(mappedName = "someDestinationName") Is there a way to add this information at runtime? Bellow is a sample Message Driven Bean class. package mdb.beans; import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; import javax.jms.Message; import javax.jms.MessageListener; @MessageDriven(mappedName = "someDestinationName", activationConfig = {

How to read messages in an order from the Queue using MDB?

≡放荡痞女 提交于 2019-12-21 17:03:54
问题 I have a MDB which listens to WebSphere MQ. It does not picks up the messages in the order that has been received by the Queue. How can i make it read it in that order? Is it possible? Should i not use a MDB. 回答1: In general, WMQ delivers messages in the order that they were received. However, several things can impact that... If the queue is set to priority instead of FIFO delivery and messages arrive in different priorities, they will be delivered "out of order". Distinguish between order

EJB's and Threading

限于喜欢 提交于 2019-12-20 14:08:40
问题 From what I understand it is illegal to spawn threads from within an EJB as it may potentially interfere with the EJB's lifecycle. However, is it illegal to use predefined Java classes from the JDK which internally spawn and handle threads such as Executor within an EJB, specifically an MDB? 回答1: The biggest issue with threads and EJBs is that threads are a limited resource heavily used by the container, and thread mistakes lead to thread pool leaks that can effectively kill the whole JVM

EJB's and Threading

青春壹個敷衍的年華 提交于 2019-12-20 14:07:12
问题 From what I understand it is illegal to spawn threads from within an EJB as it may potentially interfere with the EJB's lifecycle. However, is it illegal to use predefined Java classes from the JDK which internally spawn and handle threads such as Executor within an EJB, specifically an MDB? 回答1: The biggest issue with threads and EJBs is that threads are a limited resource heavily used by the container, and thread mistakes lead to thread pool leaks that can effectively kill the whole JVM

How to limit the number of MDB instances listening to a Jboss JMS queue

旧巷老猫 提交于 2019-12-20 09:57:14
问题 I'm having a problem with the following setup: A Java application send email msg to a JMS queue, then an MDB listening to the queue get the email msg with the onMessage method, it open a connection on the Gmail SMTP, send the email to the SMTP and close the connection. Doing this on all message in the JMS queue. It is working great when I have up to 5 messages in the queue at the same time. All messages are picked-up in the same time by 5 different instances of the MDB, so I have 5 concurrent

Changing Activation Config of Topic reading MDB at deploy time

本秂侑毒 提交于 2019-12-18 07:14:36
问题 I feel this should be easy. Just RTM and go. But I can't find the info I need. Q: Can I change the value of an @ActivationConfigProperty at deploy time without having to write any XML? More detail I have an MDB which is using the @MessageDriven annotation. Within this are a number of @ActivationConfigProperty annotations configuring it. @MessageDriven(mappedName = "jms/TestJeremyTopic ", activationConfig = { @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto

Concurrency in Message Driven Bean - Thread safe Java EE5 vs. EE6

半世苍凉 提交于 2019-12-13 09:34:51
问题 I have a situation where I need a set of operations be enclosed into a single transaction and be thread safe from a MDB. If thread A executes the instruction 1, do not want other threads can read, at least not the same, data that thread A is processing. In the code below since IMAGE table contains duplicated data, coming from different sources, this will lead in a duplicated INFRANCTION. Situation that needs to be avoided. The actual solution that I found is declaring a new transaction for

JMS and MDB with setRollbackOnly

拜拜、爱过 提交于 2019-12-12 12:14:50
问题 I have a java class which consumes messages from a queue, sending HTTP calls to some urls. I have made some search on google and also on stackoverflow (and really sorry if i have missed any sources mentioning about the problem) but couldnt find anything in details about setRollbackOnly call. My question is... in case I rollback, the message which is consumed from the queue will be blocking the rest of the queue and will be looping until it is processed successfully or it will be requeued at

Exception Deploying EJB Jar to Glassfish

China☆狼群 提交于 2019-12-12 11:19:57
问题 This is my first foray into using JMS. I have a successfully created/deployed a war file that contains a servlet that I can use to upload files. When a file is uploaded it sends a message to a JMS queue. Next I wrote a listener to retrieve the uploaded messages from the queue, but when I try to deploy it, I get this error: SEVERE: Invalid ejb jar [file-listener-ejb-1.0.jar]: it contains zero ejb. Note: 1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-

How to restrict pool size of MDB on Glassfish v3

自作多情 提交于 2019-12-12 09:43:26
问题 my Message Driven Bean executes highly intensive operations so I would like to restrict it's pool size or my server would have been overloaded. I have tried this ( code ) but it doesn't work, it's pool is still 32 ( empirically tested, time to time I restart a server so there are no pooled instances ). @MessageDriven( mappedName = "jms/TestTopic", activationConfig = { @ActivationConfigProperty( propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge" ), @ActivationConfigProperty(