Title: Adapters for Application Servers
1E163 Adapters for Application Servers
- Javier Cuerva
- Technical Architect
- eBusiness Division
- cuerva_at_sybase.com
2Agenda
- Describe the fundamental architecture of Adapters
for Application Servers (AAS) - Process Mode
- Deliver Mode
- Acquire Mode / Message Router
- Use basic troubleshooting related to deployment
and execution
3Product Overview
- AAS is a J2EE framework to bridge
- Application Servers with ERPs and CRMs via Sybase
Adapters - Application Servers with Custom Applications
accessed via an eADK based Adapter - Built on J2EE 1.3 Spec
- JMS, JNDI, EJB, MDB, XML
- Certified against EAS 4.1.x, BEA 6.1, WebSphere
4.0.1 - This is not JCA !
4Product Overview, cont
- How can I get AAS ?
- Purchasing the AAS-DK Software
- A bundle with AAS and eADK
- Purchasing one of the following adapters
- Sybase Adapter for SAP/R3
- Sybase Adapter for PeopleSoft
- Sybase Adapter for Siebel
5Product Overview, cont
- What do I get with AAS ?
- AAS framework and samples
- JMS Open Transport Driver
- Message Bridge for Java
- Documentation
6AAS Architecture
EJB
User Application (AAS Framework additional
business logic)
JMS
Adapter
EIS
JSP
Client
Servlet
Notif. Comp.
App Server EAS / BEA / WAS
DB
7AAS Framework
- The framework is composed of EJBs, MDB and a set
of supporting java classes. - ProcessMode EJB
- Provides a request-reply paradigm
- DeliverMode EJB
- Provides a one way paradigm
- MessageRouter
- MessageRouterMDB for J2EE 1.3 Compliant AppServer
( EAS and BEA ) - MessageRouterEJB for IBM WebSphere
- Captures messages initiated by the CRM/ERP
8ProcessMode EJB, Overview
- The process mode allows an App. Server to send a
request to a CRM/ERP and get a correlated reply. - It is a Stateless Session EJB that hides message
queue API, such as connecting, sending a message
to the adapters input queue and wait for the
reply or the failure. - A ProcessMode EJB needs to be configured for each
running adapter instance. - The Process Mode has
- An input Queue, to put the request
- An output Queue, to get the reply
- A failure Queue
9ProcessMode, Overview cont
(1)
(2)
Input Queue
PROCESS MODE EJB
ERP/CRM
ADAPTER
(3)
(4)
(5)
Output Queue
(4)
(5)
Fail Queue
10ProcessMode EJB deployment
- Developers need to create an EJB Jar file to
deploy the ProcessMode EJB to the App. Server. - ProcessMode EJB classes are
- Home Interface
- com.sybase.aas.ejb.ProcessModeHome
- Remote Interface
- com.sybase.aas.ejb.ProcessMode
- Implementation
- com.sybase.aas.ejb.ProcessModeImpl
11ProcessMode EJB deployment, cont
- ProcessMode Resources Environment References
- ProcessMode Resources References
12ProcessMode EJB deployment, cont
- OPT_APP_GRP and OPT_MSG_TYPE are configured in
the adapter configuration file.
13ProcessMode API
- ProcessMode exposes 6 methods
- byte process (byte request)
- byte process (byte request, long timeout)
- byte process (byte request, long timeout,
String optAppGrp, String optMsgType) - byte process(byte request, String optAppGrp,
String optMsgType) - byte getReply(CorrelationID correlationID)
- byte getReply(CorrelationID correlationID, long
timeout)
14ProcessMode API, cont
- All the methods can throw
- com.sybase.aas.TimeoutException
- com.sybase.aas.FailException
- The byte contains the XML stream to send to the
adapter, the request - The ProcessMode reads both the output Q and Fail
Q until the Timeout is expired - If everything is Ok, the reply is put in the
output Q
15ProcessMode API, cont
- If a message is found in the Fail Q, a
FailException is thrown - FailException.getFailMessage() retrieves the
failure message - If the timeout is expired, a TimeoutException is
thrown - TimeoutException.getCorrelatorID () retrieves the
CorrelationId - The CorrelationId can be passed to getReply() to
retrieve the message again
16DeliverMode EJB Overview
- Deliver mode is used by applications to supply
data to the EIS application when no direct,
synchronous reply is required. Due to the
transport nature, it is also a mean to send data
to an EIS in a batch way without having the app
server waiting for the answer. - It is a Stateless Session EJB that hides message
queue API, such as connecting and sending a
message to the adapters input queue - A DeliverMode EJB needs to be configured for each
running adapter instance. - The DeliverMode has
- An input Queue, to put the request
- DeliverMode can be combined with MessageRouter to
handle failures
17DeliverMode Overview, cont
(1)
(2)
Input Queue
DELIVER MODE EJB
ERP/CRM
ADAPTER
(3)
(4)
MESSAGE ROUTER EJB/MDB
(5)
Fail Queue
18DeliverMode EJB deployment
- Developers need to create an EJB Jar file to
deploy the DeliverMode EJB to the App. Server. - DeliverMode EJB classes are
- Home Interface
- com.sybase.aas.ejb.DeliverModeHome
- Remote Interface
- com.sybase.aas.ejb.DeliverMode
- Implementation
- com.sybase.aas.ejb.DeliverModeImpl
19DeliverMode EJB deployment, cont
- DeliverMode Resources Environment References
- DeliverMode Resources References
20DeliverMode EJB deployment, cont
21DeliverMode API
- DeliverMode exposes 4 methods
- CorrelationID deliver(byte message)
- CorrelationID deliver(byte message, String
optAppGrp, String optMsgType) - void redeliver(byte message, CorrelationID
correlationID) - void redeliver(byte message, String optAppGrp,
String optMsgType, CorrelationID correlationID)
22DeliverMode API, cont
- The message, is the XML stream for the adapter
- After writing the message in the Q, the method
returns immediately - The CorrelationID is to keep track of the message
in case of failure, and to pass it to the
redeliver method. - To read the Failure Q, a failure handler
mechanism needs to be written ( can use the
MessageRouter Object )
23Acquire Mode overview
- Acquire mode is typically used to handle requests
that are initiated externally, usually from the
EIS application itself and to transport this
request to the App. Server. - The component that implements Acquire Mode is
called MessageRouter - The MessageRouter MDB/EJB can be configured to
redirect messages to other JMS Queues using a
routing table file and the information in the
message header - The MessageRouter MDB/EJB can also be used to
handle fail messages sent by the adapter running
in Deliver Mode
24Acquire Mode overview, cont
- By default messages are routed to a default
target queue. - MessageRouter can be deployed with an optional
file, the routing table - There are two flavors
- An MDB for EAS and BEA
- An EJB for Web Sphere
25Acquire Mode overview, cont
Default Queue
(4)
ERP/CRM
MESSAGE ROUTER EJB/MDB
ADAPTER
Queue 1
(1)
(2)
(3)
(4)
(4)
Queue 2
(4)
Queue N
26MessageRouter deployment
- Developers need to create an EJB Jar file to
deploy the MessageRouter to the App. Server. - MessageRouter classes are
- J2EE 1.3 ( Sybase, WebLogic ), a MDB
- com.sybase.aas.ejb.MessageRouterMDB
- J2EE 1.2 ( IBM ), a Stateless EJB
- Home
- com.sybase.aas.ejb.MessageRouterEJBHome
- Remote Interface
- com.sybase.aas.ejb.MessageRouterEJB
- Implementation
- com.sybase.aas.ejb.MessageRouter
27MessageRouter deployment, cont
- MessageRouter Resources Environment References
- MessageRouter Resources References
28MessageRouter deployment, cont
- MessageRouter Environment
29Configuring the Routing Table
- The routing table is an ASCII file containing one
line per routing entry with the format - ltAPP_GRPgtltMSG_TYPEgtltTARGET_Qgt
- TARGET_Q must be defined in the deployment
descriptor for the MDD/EJB - APP_GRP and MSG_TYPE are stored in the header of
the message generated by the ERP/CRM Adapter - These values are defined in the adapter
configuration file. - set.msg.optionstrue
- msg.typeltset this to the value from the routing
tablegt - app.groupltset this to the value from the routing
tablegt
30Configuring the Routing Table, cont
- Routing Table Example
- ag1mt1JMS_Q_1
- ag1mt2JMS_Q_2
- ag2JMS_Q_3
- mt3JMS_Q_4
- JMS_Q_5 //This overrides the DEFAULT_Q
31MessageRouter API
- No custom method implemented in the MDB
- The EJB implements the MessageListener interface,
and provides an onMessage () method
32Troubleshooting AAS
- AAS_DEBUG_FLAG true
- Logs Message Content
- Logs Message Header
- Logs Message Properties
- Check the adapters logs, NNSYMessageLog.nml
- javax.naming.NamingException are due to missing
resources or erroneous resources. Check the EJB
resources.
33Questions ?