Tafc Calljee&Mdb



Comments



Description

Statement of Work (DRAFT) TAFC CALLJEE And Message Driven Beans Version No. 2.0 Version Date 21 November 2013 1 21 Nov 2013 Updated with CALLJEE HA changes and error codes Sheryl Rahman Sign Off History Version Date TEMENOS Authorization Client Authorization 1.TAFC CALLJEE Document Owner This document is subject to change control.0 12 Apr 2010 TAFC CALLJEE and MDBs Sheryl Rahman 1. 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. Each change must be agreed.0 Message Driven Beans 2010-04-12 . 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 Introduction This document aims to explain how to deploy Message Driven Beans (MDBs). Message Driven Beans 2010-04-12 . It can be invoked from a jBC program using the CALLJEE or JEEActivate functions and enables T24 applications to place messages on JMS queues. a special type of Enterprise Java Beans (EJBs) which utilizes the inbound connection feature of the TAFC Resource Adapter. CALLJEE is the TAFC statement that we use to invoke EJB from our T24 basic routine/ program.xml . Message Driven Beans 2010-04-12 .TAFC CALLJEE Deploying a Simple Bean JBoss has three deployment descriptors for declaring the deployment properties for enterprise beans:    ejb-jar.xml . Most J2EE app servers require the deployment of an EJB JAR within a WAR file.xml and jboss. The JBoss engine immediately inspects the contents of the archive and attempts to deploy the bean(s). interfaces.This is the standard EJB deployment descriptor. jboss. transactions. Undeploying is as easy as deleting the archive from the deploy directory. and other deployment properties (security. and even within an EAR file. you need quick. This process may be necessary in a production environment. JBoss provides the best of both worlds. enterprise beans are packaged in a JAR file with the appropriate XML files in the META-INF folder.xml . Deployment Process Ultimately.This optional file is used to specify a different JNDI name for a bean's home interface. jaws. The process of packaging up an enterprise bean with deployment descriptors into a larger archive with its deployment descriptors can become rather complex.xml ejb-name element value.This file is necessary only for CMP entity bean deployment.). To access the bean so created we will have to write the client code. All you do to deploy EJBs in JBoss is drop the archive into the deploy directory.xml files. but in development. their logical names. The default JNDI name for a bean is the ejb-jar. efficient deployment. 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. Let us try to understand this using a simple example. declaring the available enterprise beans. We are concerned with only the ejb-jar. etc. are now available to provide the jBC CALLJEE statement with connectivity to multiple servers. re-send the request in case of failure.0. <host2>.. otherwise to host2.included in TOCF(EE) pack (R12.0. Message Driven Beans 2010-04-12 . This is only required when enabling the inbound listener. CALLJEE always attempts to first establish a connection to host 1 if available.. The environment variables • • JREMOTE_INBOUND_HOST=<host> JREMOTE_INBOUND_PORT=<port> Used to connect to the JEE application server are still supported for backwards compatibility. Note: The Netty library . New environment variables • • JEE_HOSTS=<host1>. . manage connection handles and optionally provide a retry mechanism for failover. CALLJEE establishes only one connection to a single application server.must be made available to the application server’s system classloader in case the application server does not already ship this library. In order to provide connectivity and failover to secondary servers. application developers were required to use the JEEOpen/JEEActivate/JEEClose statements. CALLJEE does not fail-over at runtime – a JBC application needs to provide the retry mechanism. <port2>.. .jar) which provides an enhanced event pipeline based on the Netty serialization library. See CALLJEE error codes for identifying connection errors.TAFC CALLJEE 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. This mechanism Does NOT load balance requests between multiple servers. and so on.e.. JEE_PORTS=<port1>.2 onwards) . i. Enhanced high availability for JEE inbound connections The inbound listener now uses the TOCF framework library (tocfframework. connection error between T24 and App server) Transaction error (i. transaction related error) Error attempting to close a connection while a transaction is active Activation error (i.t24ra.Win64.String</config-property-type> <!-<config-property-value>10.Inbound listener properties --> <config-property> <description>Inbound listener server name (empty = bind to all addresses)</description> <config-property-name>listenHost</config-property-name> <config-property-type>java.Inbound listener is disabled by default (port=0).tocf. 55006 to enable inbound listener --> <config-property-value>55006</config-property-value> </config-property> CALLJEE Error Codes 0 1 2 3 4 101 102 Action successful Connection error (i.91</config-property-value> --> </config-property> <config-property> <description>Inbound listener port number (0 = inbound listener disabled)</description> <config-property-name>listenPort</config-property-name> <config-property-type>java.e. endpoint is not activated or is unable to process request) Invalid host Invalid port Message Driven Beans 2010-04-12 . Enable the port as shown below: <resourceadapter> <resourceadapterclass>com.e.7.lang.temenos.T24ResourceAdapter</resourceadapter-class> <!-. For eg: D:\R12. Set to e.ModelBank.rar).g.e.92.SCU\Temenos\ModelBankR12\3rdParty\jboss\server\default\lib Ensure “inbound listener” is configured inside the resource adapter (tocfT24rara.GA.TAFC CALLJEE Make sure you have the attached netty library inside <profile>\lib location.lang.Integer</config-property-type> <!-. private InitialContext _context.h TRANSTART ELSE CRT "Unable to start the transaction.xml inside jremote-ra.JDynArray.TAFC CALLJEE The Programs PROGRAM TEST_PRINT_MESSAGE INCLUDE JBC. import com.Level.ejb.ejb. public class myMessageBean implements MessageDrivenBean. import javax.jremote.ResourceException.mytutorial.getLogger(myMessageBean.CODE = CALLJEE (ACTIVATION. import java. a message driven bean must implement the JRemoteMessageListener interface and activate the JRemote JCA (jremote-ra.Logger.rar).Method.getName())._context=null. import javax.lang.io." In order to be callable.resource.naming. import javax.util. import javax.EJBException. } public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException{ } Message Driven Beans 2010-04-12 .class. import javax.InitialContext.reflect." ACTIVATION = "PRINTMESSAGE" INFO = "Hello folks!" ERROR. Once activated the JRemote JCA will listen for incoming requests on the configured IP address and port (see the ra.naming.jca.INFO) CRT ERROR.jbase. public myMessageBean(){ this.MessageDrivenContext. import javax. JRemoteMessageListener { private static final Logger logger = Logger.util.logging.ejb.rar). import com. import java.logging.CODE CRT "response received: >>>>":INFO:"<<<<" TRANSEND ELSE CRT "Unabel to commit the transaction.JRemoteMessageListener.jbase. import java.MessageDrivenBean.mdb.jremote.jbase. package com.inflow.PrintStream.NamingException. import java. ResourceException {} public void afterDelivery() throws ResourceException {} public void release() {} } Dissection of myMessageBean. for calling setRollbackOnly(). the following must be implemented:     A public constructor with no argument.log(Level. such as connection factories. return new JDynArray("All is well"). getUserTransaction().java The MDB class must implement the javax.MessageDrivenBean interfaces. public void ejbRemove(): usually used to free the resources allocated in the ejbCreate method. if(this. for example if the bean sends messages."Failed to create initial context".jms. The JOnAS container provides the bean with a container context that can be used for transaction management. called at the bean instantiation time.TAFC CALLJEE public void ejbCreate() throws EJBException{ try{ this.MessageListener [or use the Temenos supplied JRemoteMessageListener] and the javax. Message Driven Beans 2010-04-12 ._context= new InitialContext().. with no transaction context. } else{ return new JDynArray("ERROR").info("incoming message [" + myArray + "]")._context!=null){ String myMessage=myArray. It may be used to allocate some resources.get(1).out. } } public void beforeDelivery(Method method) throws NoSuchMethodException.ejb.e).SEVERE.g. or datasources or if the bean accesses databases. } catch (NamingException e){ logger. In addition to the onMessage method. public void ejbCreate(): with no arguments. public void setMessageDrivenContext(MessageDrivenContext mdc): called by the container after the instance creation. getRollbackOnly(). System. } } public void ejbRemove() {} public JDynArray onMessage(JDynArray myArray){ logger. e.println("myMessageBean confirming the receipt of the following message:\n" + ">>>>"+ myMessage +"<<<<"). out.rar'</depends> </message-driven> </enterprise-beans> </jboss> Message Driven Beans 2010-04-12 .xml with listening port no (55006) for jRemoteResourceAdapter <?xml version="1.xml: - Change ejb-name to something identifiable. Deployment descriptors Jboss.0" encoding="UTF-8"?> <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4. System.0//EN" "http://www.jca:service=RARDeployment.org/j2ee/dtd/jboss_4_0.println("myMessageBean confirming the receipt of the following message:\n" + ">>>>"+ myMessage +"<<<<").info("incoming message [" + myArray + "]"). That contains ra. On successful creation of a transactional context and arrival of a message thereafter. Resource adapter must be jremote-ra. the method returns a response of type jDynArray to the caller.get(1)._context!=null){ String myMessage=myArray.rar. } } The JDynArray is a jBASE type that implements a dynamic string array where attribute. return new JDynArray("All is well").name='jremote-ra.dtd"> <jboss> <enterprise-beans> <message-driven> <ejb-name>PrintMessageMDBJRemote</ejb-name> <resource-adapter-name>jremote-ra.rar</resource-adapter-name> <depends>jboss. public JDynArray onMessage(JDynArray myArray){ logger. } else{ return new JDynArray("ERROR").TAFC CALLJEE The onMessage method is activated on receipt of messages sent by a client application to the corresponding JMS destination. if(this. and subvalue delimiters mark the array indices.jboss. value. org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.jca.com/xml/ns/j2ee" xmlns:xsi="http://www.com/xml/ns/j2ee http://java. The ACTIVATION string that we use in our test program is “PRINTMESSAGE” – specify it under the <activation-config-property-value> tag.sun.0" encoding="UTF-8"?> <ejb-jar id="ejb-jar_ID" version="2.xsd"> <display-name>JMS Dispatcher</display-name> <enterprise-beans> <message-driven> <display-name>PrintMessageMDB JRemote</display-name> <ejb-name>PrintMessageMDBJRemote</ejb-name> <ejb-class>com.xml to receive requests for different activation types.xml).1" xmlns="http://java.sun.jbase. <?xml version="1.jremote.TAFC CALLJEE Ejb-jar.w3.jbase.mdb.myMessageBean</ejb-class> <messaging-type>com.com/xml/ns/j2ee/ejbjar_2_1. The jBC program can determine which MDB instance it needs to call by the ACTIVATION string.xml: Multiple instances of the MDBs can be created in the ejb-jar.sun.inflow.mytutorial.JRemoteMessageListener</messaging-type> <transaction-type>Container</transaction-type> <activation-config> <activation-config-property> <activation-config-property-name>handler</activation-config-property-name> <activation-config-property-value>PRINTMESSAGE</activation-config-property-value> </activation-config-property> </activation-config> </message-driven> </enterprise-beans> </ejb-jar> Message Driven Beans 2010-04-12 . The other thing that needs to be taken care here is the ejb-name (matched in jboss. PRINT.during deployment: Run the T24 program: JBOSS Console – When TEST.TAFC CALLJEE OUTPUTS JBOSS Console .MESSAGE is run: Message Driven Beans 2010-04-12 . 2.sun.sun.com/j2ee/connector/ JBoss http://www.TAFC CALLJEE References Temenos knowledge base http://knowledgebase.jboss.temenosgroup.html Message Driven Beans 2010-04-12 .com J2EE Connector Architecture (JCA) Specification http://java.org/ JBoss JTA Programmers guide http://labs.jboss.3/manuals/html/jta/ProgrammersGuide.com/jbosstm/docs/4.com/ Java JDK http://java.
Copyright © 2024 DOKUMEN.SITE Inc.