Questions tagged [message-driven-bean]

A message-driven bean is an enterprise bean that allows J2EE/Java EE applications to process messages asynchronously.

A message-driven bean is an enterprise bean that allows J2EE/Java EE applications to process messages asynchronously. It acts as a JMS message listener, which is similar to an event listener except that it receives messages instead of events. The messages may be sent by any J2EE/Java EE component, or by a JMS application, or a system that does not use Java technology at all.

Resources:

436 questions
32
votes
2 answers

Message queues vs sockets

I don't have much of a socket programming experience but I tried read a little about it. I am quite familiar with MDB and messaging queues. Someone has told me that queue(e.g. MDB) is "Not much more than a direct socket connection". Can someone…
Sara
  • 2,115
  • 7
  • 28
  • 51
15
votes
2 answers

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

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…
Alain
  • 237
  • 1
  • 4
  • 13
11
votes
3 answers

Why not use Session Beans instead of Message Driven Beans?

I'm wondering, why not use Session Beans instead of Message Driven Beans ? If you can call remote methods from EJBs, so why bother sending/receiving messages with Message Driven Beans (which is more difficult to develop than session beans) ? In…
mohamida
  • 774
  • 2
  • 10
  • 25
10
votes
1 answer

What is the difference between JMS consumer and Message Driven Beans (MDB)

Is there any difference between an asynchronous JMS (Java Messaging Service) consumer vs an actual MDB (Message Driven Bean). The only difference I see is the MDB class has @MessageDriven annotation which the asynchronous JMS consumer doesn't.…
robin bajaj
  • 1,668
  • 3
  • 23
  • 46
9
votes
2 answers

JavaEE 6: How to inject JMS Resource in a standalone JMS client?

I can't get javax.jms.ConnectionFactory injected into my standalone JMS client. I get a java.lang.NullPointerException at connectionFactory.createConnection() in the code below. JmsClient.java public class JmsClient { …
skip
  • 10,691
  • 27
  • 99
  • 146
8
votes
2 answers

@MessageDriven transactions and redelivery semantics

What's the best way to accomplish the following? @MessageDriven bean does some work on database on failure, I want to roll back the DB transaction but I also want the JMS message NOT to be redelivered, i.e., don't re-try. I can think of a few ways…
wrschneider
  • 15,487
  • 10
  • 70
  • 152
8
votes
2 answers

Message-driven bean (EJB3) in WebSphere 7, XA transactions, Error handling

I am a relative newb to EJB. Background: I have an MDB using the WebSphere default messaging provider receiving MapMessages that has a java.sql.DataSource to do some work, using preparedstatement, jdbc transaction, etc. I set up the MDB in the…
Morgan Dowell
  • 257
  • 5
  • 11
7
votes
1 answer

Message Groups in WebSphere MQ

I have a requirement that I need to process JMS Messages (via MDB) in a way that Messages belonging to a certain group (a group ID is set) are consumed by the same bean instance. The behaviour I require in this is that Messages with the same group…
ftr
  • 1,977
  • 14
  • 28
7
votes
4 answers

EJB's and Threading

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…
TheWolf
  • 1,553
  • 3
  • 20
  • 32
6
votes
2 answers

@RequestScoped CDI injection into @MessageDriven bean

If I have a request scoped CDI bean injected into a @MessageDriven EJB using JMS, as below, can I assume that any given Foo instance will only be used by a single onMessage invocation at a time? In other words, in the below example, can I safely use…
wrschneider
  • 15,487
  • 10
  • 70
  • 152
6
votes
2 answers

An illegal attempt to commit a one phase capable resource with existing two phase capable resources

I have an MDB in WebSphere 6. The MessageListener is linked to a Tibco EMS queue. In the MDB I'm trying to write to a WebSphere MQ queue. I get the following error: WMSG0042I: MDB Listener LoanIQ Payments Inbound started successfully for…
Synesso
  • 34,066
  • 32
  • 124
  • 194
6
votes
2 answers

Mdb vs EJB 3.1 async method

When should I choose ejb async method over MDB with java message service in order to fire async long time tasks?
Yanosh
  • 188
  • 1
  • 13
6
votes
1 answer

Send message to all nodes in JBoss cluster domain

I'm running a JBoss Wildfly 8.1.0.Final in domain mode with two nodes ("host-1" and "host-2") and need to send a message from one node to all nodes in the cluster in order to execute a certain action on all of them. The client that sends the message…
Simon Fischer
  • 1,133
  • 6
  • 21
6
votes
2 answers

Is it possible to invoke methods of secured EJBs through message-driven beans?

When a user logs in, I need to insert a message (the host name, just as an example) into the database. Since it is just a text message, injecting an EJB to a client (Servlets, JSP, JSF or something else) is quite unnecessary. The client, in this…
Tiny
  • 24,933
  • 92
  • 299
  • 571
6
votes
2 answers

Configuring MappedName annotation in Message Driven Bean dynamically

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…
Amer A.
  • 955
  • 2
  • 15
  • 22
1
2 3
29 30