Class IbisLocalSender

All Implemented Interfaces:
HasPhysicalDestination, IConfigurable, IConfigurationAware, INamedObject, IScopeProvider, ISender, ISenderWithParameters, IWithParameters, IThreadCreator, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
SendMessageJob.SendMessageJobSender

@Category("Basic") public class IbisLocalSender extends SenderWithParametersBase implements HasPhysicalDestination, IThreadCreator
Posts a message to another IBIS-adapter in the same IBIS instance. If the callee exits with an <exit> that has state PipeLine.ExitState.ERROR, an error is considered to happen in the caller which means that the exception forward is followed if it is present.

Returns exit.code as forward name to SenderPipe provided that exit.code can be parsed as integer. For example, if the called adapter has an exit state with code 2, then the SenderPipe supports a forward with name 2 that is followed when the called adapter exits with the mentioned exit. This does not work if the code is for example c2.

An IbisLocalSender makes a call to a Receiver with either a WebServiceListener or a JavaListener.

Configuration of the Adapter to be called

A call to another Adapter in the same IBIS instance is preferably made using the combination of an IbisLocalSender and a JavaListener. If, however, a Receiver with a WebServiceListener is already present, that can be used in some cases, too.

configuring IbisLocalSender and JavaListener

  • Define a SenderPipe with an IbisLocalSender
  • Set the attribute javaListener to yourServiceName
  • Do not set the attribute serviceName
In the Adapter to be called:
  • Define a Receiver with a JavaListener
  • Set the attribute name to yourServiceName
  • Do not set the attribute serviceName, except if the service is to be called also from applications other than this IBIS-instance

configuring IbisLocalSender and WebServiceListener

  • Define a SenderPipe with an IbisLocalSender
  • Set the attribute serviceName to yourIbisWebServiceName
  • Do not set the attribute javaListener
In the Adapter to be called:
  • Define a Receiver with a WebServiceListener
  • Set the attribute name to yourIbisWebServiceName
Since:
4.2
Author:
Gerrit van Brakel
Parameters
All parameters are copied to the PipeLineSession of the service called.
  • Field Details

  • Constructor Details

    • IbisLocalSender

      public IbisLocalSender()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from interface: ISender
      configure() is called once at startup of the framework in the configure method of the owner of this sender. Purpose of this method is to check whether the static configuration of the sender is correct. As much as possible class-instantiating should take place in the configure() or open() method, to improve performance.
      Specified by:
      configure in interface IConfigurable
      Specified by:
      configure in interface ISender
      Overrides:
      configure in class SenderWithParametersBase
      Throws:
      ConfigurationException
    • open

      public void open() throws SenderException
      Description copied from interface: ISender
      This method will be called to start the sender. After this method is called the sendMessage method may be called. Purpose of this method is to reduce creating connections to databases etc. in the sendMessage() method.
      Specified by:
      open in interface ISender
      Overrides:
      open in class SenderBase
      Throws:
      SenderException
    • getPhysicalDestinationName

      public String getPhysicalDestinationName()
      Specified by:
      getPhysicalDestinationName in interface HasPhysicalDestination
    • sendMessage

      public SenderResult sendMessage(Message message, PipeLineSession session) throws SenderException, TimeoutException
      Description copied from interface: ISender
      Send a message to some destination (as configured in the Sender object). This method may only be called after the configure() method is called.

      The following table shows the difference between synchronous and a-synchronous senders:

       synchronousa-synchronous
      ISender.isSynchronous() returnstruefalse
      return value of sendMessage() isthe reply-messagethe messageId of the message sent
      the correlationID specified with sendMessage()may be ignoredis sent with the message
      a {link TimeOutException}may be thrown if a timeout occurs waiting for a replyshould not be expected

      Multiple objects may try to call this method at the same time, from different threads. Implementations of this method should therefore be thread-safe, or synchronized.

      Specified by:
      sendMessage in interface ISender
      Throws:
      SenderException
      TimeoutException
    • setServiceName

      @Deprecated public void setServiceName(String serviceName)
      Deprecated.
      Name of the WebServiceListener that should be called
    • setJavaListener

      public void setJavaListener(String string)
      Name of the JavaListener that should be called (will be ignored when javaListenerSessionKey is set)
    • setJavaListenerSessionKey

      public void setJavaListenerSessionKey(String string)
      Name of the sessionKey which holds the name of the JavaListener that should be called
    • setReturnedSessionKeys

      public void setReturnedSessionKeys(String string)
      Comma separated list of keys of session variables that will be returned to caller, for correct results as well as for erroneous results. The set of available sessionKeys to be returned might be limited by the returnedSessionKeys attribute of the corresponding JavaListener.
    • setSynchronous

      public void setSynchronous(boolean b)
      If set false, the call is made asynchronously. This implies isolated=true
      Default value
      true
    • setIsolated

      public void setIsolated(boolean b)
      If true, the call is made in a separate thread, possibly using separate transaction
      Default value
      false
    • setCheckDependency

      public void setCheckDependency(boolean b)
      If true, the sender waits upon open until the called JavaListener is opened
      Default value
      true
    • setDependencyTimeOut

      public void setDependencyTimeOut(int i)
      Maximum time (in seconds) the sender waits for the listener to start. A value of -1 indicates to wait indefinitely
      Default value
      60
    • setThrowJavaListenerNotFoundException

      public void setThrowJavaListenerNotFoundException(boolean b)
      If set false, the xml-string \"<error>could not find JavaListener [...]</error>\" is returned instead of throwing a senderexception
      Default value
      true
    • getDomain

      public String getDomain()
      Specified by:
      getDomain in interface HasPhysicalDestination
    • getServiceName

      public String getServiceName()
    • getJavaListener

      public String getJavaListener()
    • getJavaListenerSessionKey

      public String getJavaListenerSessionKey()
    • isIsolated

      public boolean isIsolated()
    • isSynchronous

      public boolean isSynchronous()
      Description copied from interface: ISender
      When true, the result of sendMessage is the reply of the request.
      Specified by:
      isSynchronous in interface ISender
    • isCheckDependency

      public boolean isCheckDependency()
    • getDependencyTimeOut

      public int getDependencyTimeOut()
    • getReturnedSessionKeys

      public String getReturnedSessionKeys()
    • setIsolatedServiceCaller

      public void setIsolatedServiceCaller(IsolatedServiceCaller isolatedServiceCaller)
    • isThrowJavaListenerNotFoundException

      public boolean isThrowJavaListenerNotFoundException()
    • setThreadLifeCycleEventListener

      public void setThreadLifeCycleEventListener(ThreadLifeCycleEventListener<Object> threadLifeCycleEventListener)
      Specified by:
      setThreadLifeCycleEventListener in interface IThreadCreator