Hmmm, I am guessing there is a setting that you could change to increase the
size of the DLQ but have not found it yet.
On the other hand, the DLQ is just another queue that you can subscribe to. I
have created an MDB that picks up new messages that go to the DLQ and transfers
them to a DB. A log is created so application engineers can come in and find
all the relevant data of the message and debug the problem with the real data.
ejb-jar.xml (generated with xdoclet):
| <message-driven id="MessageDriven_15">
| <description><![CDATA[Implements the component that will subscribe
to the dead letter queue provided by the app server.]]></description>
| <ejb-name>DeadLetterQueueSubscriber</ejb-name>
|
<ejb-class>com.bluespace.core.implementation.events.subscribers.dlq.DeadLetterQueueSubscriber</ejb-class>
|
| <messaging-type>javax.jms.MessageListener</messaging-type>
| <transaction-type>Container</transaction-type>
|
<message-destination-type>javax.jms.Queue</message-destination-type>
| <activation-config>
| <activation-config-property>
|
<activation-config-property-name>destinationType</activation-config-property-name>
|
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
|
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
|
<activation-config-property-value>Auto-acknowledge</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
|
<activation-config-property-name>subscriptionDurability</activation-config-property-name>
|
<activation-config-property-value>Durable</activation-config-property-value>
| </activation-config-property>
| </activation-config>
| <env-entry>
| <env-entry-name>jms/QueueConnectionFactoryName</env-entry-name>
| <env-entry-type>java.lang.String</env-entry-type>
| <env-entry-value><![CDATA[ConnectionFactory]]></env-entry-value>
| </env-entry>
| <resource-ref id="ResRef_15">
| <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
| <res-type>javax.jms.QueueConnectionFactory</res-type>
| <res-auth>Container</res-auth>
| </resource-ref>
| </message-driven>
|
jboss.xml:
| <message-driven>
| <ejb-name>DeadLetterQueueSubscriber</ejb-name>
| <destination-jndi-name>queue/DLQ</destination-jndi-name>
| <mdb-client-id>DeadLetterQueueSubscriber</mdb-client-id>
|
<mdb-subscription-id>DeadLetterQueueSubscriber</mdb-subscription-id>
| <resource-ref>
| <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
| <jndi-name>ConnectionFactory</jndi-name>
| </resource-ref>
| </message-driven>
|
java code:
| public class DeadLetterQueueSubscriber extends BlueSpaceSubscriber {
| /* Methods for constructing new instances. */
| public DeadLetterQueueSubscriber() {
| super();
| }
|
| /* Keep out! */
| /* Constants */
| /* None at this time */
|
| /* Methods for handling messages. */
| protected void onMessage (ObjectMessage message) throws
NamingException, JMSException, Exception {
| Serializable messageObject = message.getObject();
| if (messageObject instanceof BlueSpaceEvent) {
| BusinessContext businessContext = new BusinessContext();
| try {
| BlueSpaceEvent event = (BlueSpaceEvent)
messageObject;
| Logger.DLQ.debug("Receiving event from native
dead letter queue.");
| Logger.DLQ.debug(event);
| this.moveToDeadLetterQueue(businessContext,
message, event);
| }
| finally {
| try {
| businessContext.close();
| }
| catch (BlueSpaceResourceManagementException e) {
| Logger.DLQ.error(e);
| }
| }
| }
| else {
| Logger.DLQ.error(new Object[] {"MDB ",
this.getClass().getName(), " is receiving object message of type ",
messageObject.getClass().getName(), " but was expecting
com.bluespace.core.interfaces.events.abstracts.BlueSpaceEvent"});
| }
| }
|
| protected void onMessage (BusinessContext businessContext,
BlueSpaceEvent event) throws Exception {
| /* No implementation required, will not be called as this class
overrides onMessage(ObjectMessage). */
| }
|
| /**
| * Moves a [EMAIL PROTECTED] javax.jms.Message Message} containing a
[EMAIL PROTECTED] BlueSpaceEvent BlueSpaceEvent} that was delivered too many
times
| * to the dead letter queue.<br>
| * It will transform the BlueSpaceEvent to a [EMAIL PROTECTED]
com.bluespace.core.implementation.events.dlq.DeadLetter DeadLetter}
| * and write that straight into the database, using immediate access to
a [EMAIL PROTECTED] com.bluespace.core.persistence.tools.sql.StoredProcedure
StoredProcedure}.
| * This may break development guidelines and software engineering
principles because we break the layering
| * but it does reduce the risk of not being able to persist the
DeadLetter.<br>
| * If that still fails, the transaction will be marked for rollback and
the message will be returned to the JMS engine one more time.
| * The JMS engine should be configured thus that the redelivery is set
to be 1 bigger than the BlueSpace TransMail System maximum redelivery setting.
| * This way, when the Message is once again returned to the JMS engine,
the latter will transfer it to its own dead letter queue.
| *
| * @param businessContext
| * @param message
| * @param event
| */
| protected void moveToDeadLetterQueue (BusinessContext businessContext,
Message message, BlueSpaceEvent event) {
| try {
| if (Logger.DLQ.isInfoEnabled()) {
| Logger.DLQ.info(
| new Object[] {
| "Moving ",
| event,
| " from native dead letter queue
to the real dead letter queue"});
| }
| CreateDeadLetter deadLetterCreator = new
CreateDeadLetter(new DeadLetter(message.getJMSMessageID(), event,
this.getClass(), -1));
| deadLetterCreator.execute(businessContext,
this.getDataSourceLocator().getSystemDataSource());
| }
| catch (NamingException e) {
| Logger.DLQ.error(e);
| Logger.DLQ.error("Error while getting datasource to
persist a BlueSpaceEvent to the dead letter queue.\nCommitting transaction
anyway to avoid looping here.", e);
| }
| catch (JMSException e) {
| Logger.DLQ.error(e);
| Logger.DLQ.error("Error while getting information to
persist a BlueSpaceEvent to the dead letter queue.\nCommitting transaction
anyway to avoid looping here.", e);
| }
| catch (IOException e) {
| Logger.DLQ.error(e);
| Logger.DLQ.error("Error while getting information to
persist a BlueSpaceEvent to the dead letter queue.\nCommitting transaction
anyway to avoid looping here.", e);
| }
| catch (PersistenceException e) {
| Logger.DLQ.error(e);
| Logger.DLQ.error("Error while persisting a
BlueSpaceEvent to the dead letter queue.\nCommitting transaction anyway to
avoid looping here.", e);
| }
| catch (Throwable e) {
| Logger.DLQ.error(e);
| Logger.DLQ.error("General error while persisting a
BlueSpaceEvent to the dead letter queue.\nCommitting transaction anyway to
avoid looping here.", e);
| }
| }
|
| /* Class variables */
| /* None at this time */
| /* Instance variables */
| /* None at this time */
| }
|
The CreateDeadLetter component is a java wrapper around an oracle stored
procedure.
Hope this helps for you.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3908996#3908996
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3908996
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user