tafc calljee&mdb

12
TAFC CALLJEE And Message Driven Beans Version No. 2.0 Version Date 21 November 2013

Upload: sudhakarcscbe

Post on 09-Nov-2015

1.029 views

Category:

Documents


111 download

DESCRIPTION

Guide to Implement CALLJEE with MDB

TRANSCRIPT

  • Statement of Work (DRAFT)

    TAFC CALLJEE

    And

    Message Driven Beans

    Version No. 2.0

    Version Date

    21 November 2013

  • TAFC CALLJEE

    Message Driven Beans 2010-04-12

    Document Owner

    This document is subject to change control. Each change must be agreed, annotated and signed by the owners of the document listed below: -

    The owners of this document are listed below:

    TEMENOS Helpdesk Manager Sriraman Ganesan

    Revision History

    Version Revision Date Revision Description Author

    1.0 12 Apr 2010 TAFC CALLJEE and MDBs Sheryl Rahman

    1.1 21 Nov 2013 Updated with CALLJEE HA

    changes and error codes

    Sheryl Rahman

    Sign Off History

    Version Date TEMENOS Authorization Client Authorization

    1.0

  • TAFC CALLJEE

    Message Driven Beans 2010-04-12

    Introduction

    This document aims to explain how to deploy Message Driven Beans (MDBs), a special type of Enterprise Java Beans (EJBs) which utilizes the inbound connection feature of the TAFC Resource Adapter. It can be invoked from a jBC program using the CALLJEE or JEEActivate functions and enables T24 applications to place messages on JMS queues. These remote calls are achieved by using a TCP/IP connection from the TAFC process to a Java Enterprise Edition Application Server such as JBoss. The only configuration necessary in TAFC is a host and a port.

  • TAFC CALLJEE

    Message Driven Beans 2010-04-12

    Deploying a Simple Bean

    JBoss has three deployment descriptors for declaring the deployment properties for enterprise beans:

    ejb-jar.xml - This is the standard EJB deployment descriptor, declaring the available enterprise beans, their logical names, interfaces, and other deployment properties (security, transactions, etc.).

    jboss.xml - This optional file is used to specify a different JNDI name for a bean's home interface. The default JNDI name for a bean is the ejb-jar.xml ejb-name element value.

    jaws.xml - This file is necessary only for CMP entity bean deployment.

    We are concerned with only the ejb-jar.xml and jboss.xml files.

    Deployment Process

    Ultimately, enterprise beans are packaged in a JAR file with the appropriate XML files in the META-INF folder. Most J2EE app servers require the deployment of an EJB JAR within a WAR file, and even within an EAR file. The process of packaging up an enterprise bean with deployment descriptors into a larger archive with its deployment descriptors can become rather complex. This process may be necessary in a production environment, but in development, you need quick, efficient deployment. JBoss provides the best of both worlds.

    All you do to deploy EJBs in JBoss is drop the archive into the deploy directory. The JBoss engine immediately inspects the contents of the archive and attempts to deploy the bean(s). Undeploying is as easy as deleting the archive from the deploy directory.

    To access the bean so created we will have to write the client code. Let us try to understand this using a simple example. Our T24 program will communicate to the MDB that prints a message to standard output and returns an All OK response to the basic program if everything goes well. CALLJEE is the TAFC statement that we use to invoke EJB from our T24 basic routine/ program.

  • TAFC CALLJEE

    Message Driven Beans 2010-04-12

    Enhanced high availability for JEE inbound connections

    The jBC CALLJEE statement enables application developers to send messages to the application server and therefore provide connectivity to other systems. The environment variables JREMOTE_INBOUND_HOST= JREMOTE_INBOUND_PORT= Used to connect to the JEE application server are still supported for backwards compatibility. In order to provide connectivity and failover to secondary servers, application developers were required to use the JEEOpen/JEEActivate/JEEClose statements, manage connection handles and optionally provide a retry mechanism for failover. New environment variables JEE_HOSTS=, , ... JEE_PORTS=, , ... are now available to provide the jBC CALLJEE statement with connectivity to multiple servers. This mechanism - Does NOT load balance requests between multiple servers. CALLJEE establishes only one connection to a single application server. - CALLJEE always attempts to first establish a connection to host 1 if available, otherwise to host2, and so on. - CALLJEE does not fail-over at runtime a JBC application needs to provide the retry mechanism, i.e. re-send the request in case of failure. See CALLJEE error codes for identifying connection errors.

    Enhanced high availability for JEE inbound connections

    The inbound listener now uses the TOCF framework library (tocfframework.jar) which provides an enhanced event pipeline based on the Netty serialization library. Note: The Netty library - included in TOCF(EE) pack (R12.0.0.2 onwards) - must be made available to the application servers system classloader in case the application server does not already ship this library. This is only required when enabling the inbound listener.

  • TAFC CALLJEE

    Message Driven Beans 2010-04-12

    - Make sure you have the attached netty library inside \lib location. For eg: D:\R12.GA.ModelBank.Win64.SCU\Temenos\ModelBank-R12\3rdParty\jboss\server\default\lib - Ensure inbound listener is configured inside the resource adapter (tocfT24ra-ra.rar). Enable the port as shown below: com.temenos.tocf.t24ra.T24ResourceAdapter Inbound listener server name (empty = bind to all addresses) listenHost java.lang.String Inbound listener port number (0 = inbound listener disabled) listenPort java.lang.Integer 55006

    CALLJEE Error Codes

    0 Action successful

    1 Connection error (i.e. connection error between T24 and App server)

    2 Transaction error (i.e. transaction related error)

    3 Error attempting to close a connection while a transaction is active

    4 Activation error (i.e. endpoint is not activated or is unable to process request)

    101 Invalid host

    102 Invalid port

  • TAFC CALLJEE

    Message Driven Beans 2010-04-12

    The Programs

    PROGRAM TEST_PRINT_MESSAGE INCLUDE JBC.h TRANSTART ELSE CRT "Unable to start the transaction." ACTIVATION = "PRINTMESSAGE" INFO = "Hello folks!" ERROR.CODE = CALLJEE (ACTIVATION,INFO) CRT ERROR.CODE CRT "response received: >>>>":INFO:"

  • TAFC CALLJEE

    Message Driven Beans 2010-04-12

    public void ejbCreate() throws EJBException{ try{ this._context= new InitialContext(); } catch (NamingException e){ logger.log(Level.SEVERE,"Failed to create initial context",e); } } public void ejbRemove() {} public JDynArray onMessage(JDynArray myArray){ logger.info("incoming message [" + myArray + "]"); if(this._context!=null){ String myMessage=myArray.get(1); System.out.println("myMessageBean confirming the receipt of the following message:\n" + ">>>>"+ myMessage +"

  • TAFC CALLJEE

    Message Driven Beans 2010-04-12

    The onMessage method is activated on receipt of messages sent by a client application to the corresponding JMS destination.

    public JDynArray onMessage(JDynArray myArray){ logger.info("incoming message [" + myArray + "]"); if(this._context!=null){ String myMessage=myArray.get(1); System.out.println("myMessageBean confirming the receipt of the following message:\n" + ">>>>"+ myMessage +"

  • TAFC CALLJEE

    Message Driven Beans 2010-04-12

    Ejb-jar.xml:

    Multiple instances of the MDBs can be created in the ejb-jar.xml to receive requests for different activation types. The jBC program can determine which MDB instance it needs to call by the ACTIVATION string. The ACTIVATION string that we use in our test program is PRINTMESSAGE specify it under the tag.

    The other thing that needs to be taken care here is the ejb-name (matched in jboss.xml).

    JMS Dispatcher PrintMessageMDB JRemote PrintMessageMDBJRemote com.jbase.mytutorial.mdb.myMessageBean com.jbase.jremote.jca.inflow.JRemoteMessageListener Container handler PRINTMESSAGE

  • TAFC CALLJEE

    Message Driven Beans 2010-04-12

    OUTPUTS

    JBOSS Console - during deployment:

    Run the T24 program:

    JBOSS Console When TEST.PRINT.MESSAGE is run:

  • TAFC CALLJEE

    Message Driven Beans 2010-04-12

    References

    Temenos knowledge base http://knowledgebase.temenosgroup.com/

    Java JDK http://java.sun.com

    J2EE Connector Architecture (JCA) Specification http://java.sun.com/j2ee/connector/

    JBoss http://www.jboss.org/

    JBoss JTA Programmers guide

    http://labs.jboss.com/jbosstm/docs/4.2.3/manuals/html/jta/ProgrammersGuide.html