message-driven-bean

Message queues vs sockets

二次信任 提交于 2019-12-05 09:33:51
问题 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 compare these two for me. 回答1: eeeeemph... this someone was very wrong. The two are incomparable, as they live in different layers. It's like saying that "a relational database is not much more than a file on a disk" or "a house is not much more than a

@RequestScoped CDI injection into @MessageDriven bean

Deadly 提交于 2019-12-05 06:33:25
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 member variables in the Foo object to store state across subroutines, analogously to a JSF @RequestScoped managed bean? Note that it's ok if the same Foo object gets recycled sequentially from one onMessage call to the next, as long as each MessageDrivenBean instance has its own Foo instance such that two requests processing concurrently would be

Weblogic Message Driven Bean reading from a secured queue @RunAs does not work

杀马特。学长 韩版系。学妹 提交于 2019-12-04 20:28:22
I have a MDB very simple which works fine as long as the queue from where it reads messages is not secured After I secure the Queue with a username it can;t read messages anymore @MessageDriven(mappedName = "DistributedQueueTest") public class MdbReceiver implements MessageListener { @Resource private MessageDrivenContext mdc; @Override public void onMessage(Message inMessage) { TextMessage msg = null; try { msg = (TextMessage) inMessage; System.out.println("Test MdbReceiver Message received : " + msg.getText()); } catch (JMSException e) { e.printStackTrace(); mdc.setRollbackOnly(); } } } I

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

断了今生、忘了曾经 提交于 2019-12-04 07:47:35
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. 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 produced and order delivered. If the messages are produced on a remote QMgr and there are multiple paths to

Message Groups in WebSphere MQ

自古美人都是妖i 提交于 2019-12-04 04:55:26
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 ID are processed sequentially (though message ordering is irrelevant), and tying them to the same MDB-instance should provide that. The messages do not carry any kind of sequence number (as it is irrelevant) and we do not know what the first or last message in a group is (there could theoratically "never" be a last message in a group). We want them

Message queues vs sockets

本小妞迷上赌 提交于 2019-12-03 22:20:32
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 compare these two for me. eeeeemph... this someone was very wrong. The two are incomparable, as they live in different layers. It's like saying that "a relational database is not much more than a file on a disk" or "a house is not much more than a brick". Messaging queue is a piece of software that glues senders and receivers so that they can

EJB's and Threading

佐手、 提交于 2019-12-03 03:23:34
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? 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 instance. Executor should be better behaved, but it's still going to use up a thread for some length of time;

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

不打扰是莪最后的温柔 提交于 2019-12-02 20:48:23
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 connection to the Gmail SMTP server. But when there is more messages in the JMS queue, I get a

Can we use ejb-jar.xml instead of annotations for MessageDrivenBean(MDB) in EJB 3.0?

半腔热情 提交于 2019-12-01 18:43:24
I've configured the message destination type, name etc using @ActivationConfigProperty in EJB 3.0 but I wanted to configure the MDB using deployment descriptor ( ejb-jar.xml ) as in EJB 2.0. FYI: I'm using JBoss 6 Can anyone guide me on this? Adheep Mohamed Abdul Kader Thanks man, but I've figured it out in a much simpler way. Below is the code <ejb-jar id="ejb-jar_ID" version="3.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"> <display

Can we use ejb-jar.xml instead of annotations for MessageDrivenBean(MDB) in EJB 3.0?

帅比萌擦擦* 提交于 2019-12-01 18:27:20
问题 I've configured the message destination type, name etc using @ActivationConfigProperty in EJB 3.0 but I wanted to configure the MDB using deployment descriptor ( ejb-jar.xml ) as in EJB 2.0. FYI: I'm using JBoss 6 Can anyone guide me on this? 回答1: Thanks man, but I've figured it out in a much simpler way. Below is the code <ejb-jar id="ejb-jar_ID" version="3.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun