monitoring bean using EJB3 - ejb-3.0

I'm working on a system where we write all of our events to a Topic where they get picked up by a TraceLoggingSubscriberMDB, PrivacyLoggingSubscriberMDB and I'm hoping to add a MonitoringSubscriberMDB. What the monitoring subscriber would do is to make sure a message coming into the system completed it's workflow.
For example a single inbound message would generate JMS messages, "Event 1", "Event 2", "Event N" that each get published to the event Topic. I need a way to see if something gets hung up on "Event 2" and send an email. I'm not sure how to approach this since everything is stateless. Any suggestions?
Thanks!

What about using an Interceptor over the MDB processing the events. It could check for some exception and raise some alert.

Related

MQ Format MBAGGR01

I need to identify reason why message was send in DLQ queue.
I read message with RFHUtil and viewed that it have type MBAGGR01.
I understand that this message contains multiple Aggregation folders. Is it way for resend or view data in Aggregation folders?
Thank you.
I did to resend this message with RFHUtil - on DLQ tab press the button "Prepare for resend". In syslog I found reason of DLQ.
But I don't know how to identify reason why message was send in DLQ queue without retry.

Who can be clients in JMS

I have list of emails (to many). I want to write scheduler, which sends emails periodically.
I read emails from database
I send messages to this emails.
As I see for good performance, it is good to use JMS (Topic) to make this.
In documentation I read that Topic sends messages to all clients. Could you enplane me what does "client" means at this case? In my opinion, wich my example, they are the owner of the emails and my system will send the message text to this owner of email (Clients). Is it right?
No, in this context, "all clients" means all java processes that have an open subscription to the topic.
You would need to write code to convert from JMS to Email (and send it). Frameworks like Spring Integration can be used for this, it does all the heavy lifting for you; you would simply wire a JMS message-driven-channel-adapter to receive the message from a queue (not a topic), do a JDBC query to get the emails, then send them via a mail outbound-channel-adapter.
Read the project documentation for more information (there's a link to it from the project page link above).

Acknowledging a message from AMQP in Camel

Currently I'm using bluelock's camel-spring-amqp component for my application.
What I want to achieve is:
Pull a message from RabbitMQ server.
Persist it to a database on successful processing / Send it to another "Error" queue on Exception
Tell the original queue that it is now safe to remove the message from the queue.
As of this writing, I'm able to pull from rabbit and persist to database using camel routes. What I don't really know how to do is acknowledge that my processing is done to the original queue. Here is my current route:
from("spring-amqp:EXCHANGE:queuename?autodelete=false&durable=true&type=direct&routingKey=")
.bean(Transform.class, "transform(byte[])")
.to("jpa:com.my.company.models.MyModel?entityType=java.util.ArrayList")
I realize I can set the acknowledgmentMode to NONE. But I don't know how to "manually" acknowledge once I have persisted my message.
Thanks for any help!
I'm new in Camel but I know a thing or two about RabbitMQ.
With RabbitMQConsumer the message is acknowledged if the processor doesn't throw any exception (line 133 at RabbitMQConsumer source).
So I suppose if you let your processor propagate the exception, the message won't be acknowledged. I haven't used spring-amqp but I guess it should have a similar behaviour.

JMS Workflow - mixing Queues and Topics

I have a question on how JMS is supposed to be used. Here's my case:
I have a queue with multiple consumers
A message gets sent to the queue - f.e. a "login" message
One of the consumers processes the message
Now I want to tell all my systems about the "login" message - i.e. that the user successfully logged in. What I'm currently doing is:
The consumer that processed the message sends a message to a Topic where everybody listens telling them "User x successfully logged in". Let's call this SUCCESS.
Now every system concerned knows that "user x has successfully logged in" due to the SUCCESS message. This is what I want.
However, if I understood JMS message delivery rules right, it is theoretically possible that a message to another topic/queue that relies on the fact that the receiving consumer knows that "user x logged in" could arrive before my SUCCESS message has been received. Even if it was sent after the session.send() call of the SUCCESS message. Is that right?
If so, how are you supposed to implement such a case with JMS?
Any help would be greatly appreciated!
Is that right?
Unfortunately, yes.
If so, how are you supposed to implement such a case with JMS?
Two different approaches come to my mind:
simulate other network protocols - add ACKNOWLEDGE message that every system must sent when it receives SUCCESS message. ACKNOWLEDGE message would be sent to some dedicated topic, and messages that rely on the fact the receiving consumer knows that user x logged in cannot be sent until ACKNOWLEDGE message arrived from that consumer.
send both SUCCESS and further messages on same topic (if that's applicable; other consumers can ignore further messages if they aren't final destination), and give greater priority to SUCCESS message. That should (at least theoretically - JMS API doesn't require this!) guarantee that SUCCESS message arrived prior to messages that rely on the fact the receiving consumer knows that user x logged in. The method that should interest you in this case is Message#setJMSPriority

Java Messenger service topic subscriber program termination

I have a JMS ( ACTIVEMQ ) subscriber(asynchronous) that is polling a topic to receive the message from the JMS provider. The provider is putting an object message into the topic every 5 sec and that subscriber is receiving it as usual.Now when the subscriber terminates, the publisher still continuous to put the messages into the topic. so i want to know how can i handle the program termination of subscriber( i,e i want to know how to handle or what method is called when the subscriber terminates). when the subscriber shuts , the provider keeps on putting the messages into the topic . The provider is running on the server and subscriber is running on the client.
please help :)
Advisory Messages is probably what you are looking for. I have not implemented them myself, but I've read it is possible. You should be looking at the consumerCount
Cheers, Eugene.

Resources