com.softwareag.jca
Interface PMQMessageListener


public interface PMQMessageListener

Provides an interface to receive messages as message driven bean from PMQMessageServer connector adapter. PMQMessageStreamListener is an other message driven brean interface.
To configure your EJB implementation, use the following META-INF/ejb-jar.xml as an example in application deployment descriptor.

 <ejb-jar 
        version="2.1" 
        xmlns="http://java.sun.com/xml/ns/j2ee" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">

        <display-name>PMQConnectorTest</display-name>
        <enterprise-beans> 
                <message-driven> 
                        <ejb-name>PMQReceiverBean</ejb-name> 
                        <ejb-class>com.mysoftcompany.test.PMQReceiverBean</ejb-class> 
                        <messaging-type>com.softwareag.jca.PMQMessageListener</messaging-type> 
                        <transaction-type>Container</transaction-type>
                        <activation-config> 
                                <activation-config-property> 
                                        <activation-config-property-name>broker</activation-config-property-name> 
                                        <activation-config-property-value>localhost</activation-config-property-value> 
                                </activation-config-property> 
                                <activation-config-property> 
                                        <activation-config-property-name>service</activation-config-property-name> 
                                        <activation-config-property-value>QUEUE/XML/TEST</activation-config-property-value> 
                                </activation-config-property> 
                                <activation-config-property> 
                                        <activation-config-property-name>userid</activation-config-property-name> 
                                        <activation-config-property-value>jca-server</activation-config-property-value> 
                                </activation-config-property> 
                                <activation-config-property>
                                        <activation-config-property-name>replicates</activation-config-property-name> 
                                        <activation-config-property-value>1</activation-config-property-value> 
                                </activation-config-property> 
                        </activation-config> 
                </message-driven> 

        <assembly-descriptor>
                <container-transaction>
                        <method>
                                <ejb-name>PMQReceiverBean</ejb-name>
                                <method-name>*</method-name>
                        </method>
                        <trans-attribute>Required</trans-attribute>
                </container-transaction>
        </assembly-descriptor>

 </ejb-jar>
 
See PMQActivationSpec setter and getter methods for more config properties. Depends on the web application server, the message driven bean is binding to the connector implementation RAR file PMQConnector.rar. JBoss requires META-INF/jboss.xml:
        <?xml version="1.0" encoding="UTF-8"?>
        <jboss>
           <enterprise-beans>
              <message-driven>
                 <ejb-name>PMQReceiverBean</ejb-name>
                 <destination-jndi-name>dummy</destination-jndi-name>
                 <resource-adapter-name>PMQConnector.rar</resource-adapter-name>
              </message-driven>   
           </enterprise-beans>
        </jboss>
 

Version:
$Revision: 1.2 $

Method Summary
 void onMessage(PMQMessage message)
          Is called for each received message.
 

Method Detail

onMessage

void onMessage(PMQMessage message)
               throws java.lang.Throwable
Is called for each received message. The message dispatcher PMQMessageStreamDispatcher implements the javax.transaction.xa.XAResource interface. Therefore, the message delivery is included in your local (e.g. JDBC) transaction.

Parameters:
message - container for message details
Throws:
java.lang.Throwable - throws exception to rollback (backout) the delivery. The delivery process is restartet.


Copyright © 2004-2008 Software AG. All Rights Reserved.