public abstract class SapListenerImpl extends SapFunctionFacade implements ISapListener<com.sap.conn.jco.JCoFunction>, com.sap.conn.jco.server.JCoServerFunctionHandler, com.sap.conn.jco.server.JCoServerTIDHandler, com.sap.conn.idoc.jco.JCoIDocHandlerFactory, com.sap.conn.idoc.jco.JCoIDocHandler, com.sap.conn.jco.server.JCoServerExceptionListener, com.sap.conn.jco.server.JCoServerErrorListener
IPushingListener
,
that enables a GenericReceiver to receive messages from SAP-systems.
In SAP the function to be called is a RFC-function to the destination that is registered using progid
.
N.B. If no requestFieldIndex or requestFieldName is specified, input is converted to xml;
If no replyFieldIndex or replyFieldName is specified, output is converted from xml.
log
Constructor and Description |
---|
SapListenerImpl() |
Modifier and Type | Method and Description |
---|---|
void |
afterMessageProcessed(PipeLineResult processResult,
Object rawMessageOrWrapper,
Map<String,Object> threadContext)
Called to perform actions (like committing or sending a reply) after a message has been processed by the
Pipeline.
|
boolean |
checkTID(com.sap.conn.jco.server.JCoServerContext serverCtx,
String tid)
SAP JCo.Server javadoc says:
This function will be invoked when a transactional RFC is being called from a
SAP R/3 system.
|
void |
close()
Close all resources used for listening.
|
void |
commit(com.sap.conn.jco.server.JCoServerContext serverCtx,
String tid)
SAP JCo.Server javadoc says:
This function will be called after all RFC functions belonging to a certain transaction
have been successfully completed.
|
void |
configure()
configure() is called once at startup of the framework in the configure() method
of the owner of this listener. |
void |
confirmTID(com.sap.conn.jco.server.JCoServerContext serverCtx,
String tid)
SAP JCo.Server javadoc says:
This function will be called after the local transaction has been completed.
|
Message |
extractMessage(com.sap.conn.jco.JCoFunction rawMessage,
Map<String,Object> threadContext)
Extracts string from message obtained from
IPullingListener.getRawMessage(Map) . |
protected String |
getFunctionName()
We don't use functions when receiving SAP messages
|
String |
getIdFromRawMessage(com.sap.conn.jco.JCoFunction rawMessage,
Map<String,Object> threadContext)
Extracts ID-string from message obtained from
IPullingListener.getRawMessage(Map) . |
com.sap.conn.idoc.jco.JCoIDocHandler |
getIDocHandler(com.sap.conn.idoc.jco.JCoIDocServerContext serverCtx) |
String |
getPhysicalDestinationName() |
void |
handleRequest(com.sap.conn.jco.server.JCoServerContext serverCtx,
com.sap.conn.idoc.IDocDocumentList documentList) |
void |
handleRequest(com.sap.conn.jco.server.JCoServerContext jcoServerContext,
com.sap.conn.jco.JCoFunction jcoFunction) |
void |
open()
Prepares the listener for receiving messages.
|
void |
rollback(com.sap.conn.jco.server.JCoServerContext serverCtx,
String tid)
SAP JCo.Server javadoc says:
This function will be called if an error in one of the RFC functions belonging to
a certain transaction has occurred.
Derived servers can override this method to locally rollback the transaction.
|
void |
serverErrorOccurred(com.sap.conn.jco.server.JCoServer server,
String connectionID,
com.sap.conn.jco.server.JCoServerContextInfo serverCtx,
Error e) |
void |
serverExceptionOccurred(com.sap.conn.jco.server.JCoServer server,
String connectionID,
com.sap.conn.jco.server.JCoServerContextInfo serverCtx,
Exception e) |
void |
setConnectionCount(String connectionCount)
The number of connections that should be registered at the gateway
|
void |
setExceptionListener(IbisExceptionListener listener)
Set a (single) listener that will be notified of any exceptions.
|
void |
setHandler(IMessageHandler<com.sap.conn.jco.JCoFunction> handler)
Set the handler that will do the processing of the message.
|
void |
setProgid(String string)
Name of the RFC-destination to be registered in the SAP system
|
void |
setSapSystemName(String string)
Name of the
SapSystem used by this object |
calculateStaticFieldIndices, closeFacade, findFieldIndex, functionCall2message, functionResult2message, getCorrelationIdFromField, getFunctionTemplate, getFunctionTemplate, getLogPrefix, getSapSystem, getSapSystem, message2FunctionCall, message2FunctionResult, openFacade, setCorrelationIdFieldIndex, setCorrelationIdFieldName, setName, setParameters, setReplyFieldIndex, setReplyFieldName, setRequestFieldIndex, setRequestFieldName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, setName
getApplicationContext, getName
getConfigurationClassLoader
setApplicationContext
setCorrelationIdFieldIndex, setCorrelationIdFieldName, setReplyFieldIndex, setReplyFieldName, setRequestFieldIndex, setRequestFieldName
getDomain
public void configure() throws ConfigurationException
IListener
configure()
is called once at startup of the framework in the configure()
method
of the owner of this listener.
Purpose of this method is to reduce creating connections to databases etc. in the IPullingListener.getRawMessage(Map)
method.
As much as possible class-instantiating should take place in the
configure()
or open()
method, to improve performance.configure
in interface IConfigurable
configure
in interface IListener<com.sap.conn.jco.JCoFunction>
configure
in class SapFunctionFacade
ConfigurationException
public void open() throws ListenerException
IListener
open()
is called once each time the listener is started.open
in interface IListener<com.sap.conn.jco.JCoFunction>
ListenerException
public void close() throws ListenerException
IListener
close
in interface IListener<com.sap.conn.jco.JCoFunction>
ListenerException
public com.sap.conn.idoc.jco.JCoIDocHandler getIDocHandler(com.sap.conn.idoc.jco.JCoIDocServerContext serverCtx)
getIDocHandler
in interface com.sap.conn.idoc.jco.JCoIDocHandlerFactory
public String getPhysicalDestinationName()
getPhysicalDestinationName
in interface HasPhysicalDestination
getPhysicalDestinationName
in class SapFunctionFacade
public String getIdFromRawMessage(com.sap.conn.jco.JCoFunction rawMessage, Map<String,Object> threadContext) throws ListenerException
IListener
IPullingListener.getRawMessage(Map)
. May also extract
other parameters from the message and put those in the context.
getIdFromRawMessage
in interface IListener<com.sap.conn.jco.JCoFunction>
ListenerException
public Message extractMessage(com.sap.conn.jco.JCoFunction rawMessage, Map<String,Object> threadContext) throws ListenerException
IListener
IPullingListener.getRawMessage(Map)
. May also extract
other parameters from the message and put those in the threadContext.extractMessage
in interface IListener<com.sap.conn.jco.JCoFunction>
ListenerException
public void afterMessageProcessed(PipeLineResult processResult, Object rawMessageOrWrapper, Map<String,Object> threadContext) throws ListenerException
IListener
afterMessageProcessed
in interface IListener<com.sap.conn.jco.JCoFunction>
ListenerException
public void handleRequest(com.sap.conn.jco.server.JCoServerContext jcoServerContext, com.sap.conn.jco.JCoFunction jcoFunction) throws com.sap.conn.jco.AbapException, com.sap.conn.jco.AbapClassException
handleRequest
in interface com.sap.conn.jco.server.JCoServerFunctionHandler
com.sap.conn.jco.AbapException
com.sap.conn.jco.AbapClassException
public void handleRequest(com.sap.conn.jco.server.JCoServerContext serverCtx, com.sap.conn.idoc.IDocDocumentList documentList)
handleRequest
in interface com.sap.conn.idoc.jco.JCoIDocHandler
@Mandatory public void setSapSystemName(String string)
SapFunctionFacade
SapSystem
used by this objectsetSapSystemName
in interface ISapFunctionFacade
setSapSystemName
in class SapFunctionFacade
@Mandatory public void setProgid(String string)
setProgid
in interface ISapListener<com.sap.conn.jco.JCoFunction>
public void setConnectionCount(String connectionCount)
setConnectionCount
in interface ISapListener<com.sap.conn.jco.JCoFunction>
public void setHandler(IMessageHandler<com.sap.conn.jco.JCoFunction> handler)
IPushingListener
setHandler
in interface IPushingListener<com.sap.conn.jco.JCoFunction>
public void setExceptionListener(IbisExceptionListener listener)
IPushingListener
setExceptionListener
in interface IPushingListener<com.sap.conn.jco.JCoFunction>
public void serverExceptionOccurred(com.sap.conn.jco.server.JCoServer server, String connectionID, com.sap.conn.jco.server.JCoServerContextInfo serverCtx, Exception e)
serverExceptionOccurred
in interface com.sap.conn.jco.server.JCoServerExceptionListener
public void serverErrorOccurred(com.sap.conn.jco.server.JCoServer server, String connectionID, com.sap.conn.jco.server.JCoServerContextInfo serverCtx, Error e)
serverErrorOccurred
in interface com.sap.conn.jco.server.JCoServerErrorListener
public boolean checkTID(com.sap.conn.jco.server.JCoServerContext serverCtx, String tid)
true
.
The method has to return false
if the a transaction with this ID has already
been process. Throw an exception if anything goes wrong. The transaction processing will be
aborted thereafter.
Derived servers must override this method to actually implement the transaction ID management.checkTID
in interface com.sap.conn.jco.server.JCoServerTIDHandler
tid
- the transaction IDtrue
if the ID is valid and not in use otherwise, false
otherwisepublic void confirmTID(com.sap.conn.jco.server.JCoServerContext serverCtx, String tid)
confirmTID
in interface com.sap.conn.jco.server.JCoServerTIDHandler
tid
- the transaction IDpublic void commit(com.sap.conn.jco.server.JCoServerContext serverCtx, String tid)
commit
in interface com.sap.conn.jco.server.JCoServerTIDHandler
tid
- the transaction IDpublic void rollback(com.sap.conn.jco.server.JCoServerContext serverCtx, String tid)
rollback
in interface com.sap.conn.jco.server.JCoServerTIDHandler
tid
- the transaction IDprotected String getFunctionName()
getFunctionName
in class SapFunctionFacade
Copyright © 2023 Frank!Framework. All rights reserved.