com.highdeal.hci
Interface MessageSender

All Known Implementing Classes:
AdminMessageSender, HttpMessageSender, UpdaterMessageSender

public interface MessageSender

This Java interface is the parent interface for all the message senders that you can implement in your client applications depending on your business requirements; it defines the necessary methods for sending (asynchronous, synchronous, or client-side timeout) the HCI messages that include the operation requests for the connected SAP CC system.

Implementation in Your Client Application

If you want to implement some business services provided by the HTTP Communication Interface (HCI) technical interface of SAP Convergent Charging, you must develop a message sender in your client application to send HCI messages and receive the results:

Notse

You can implement asynchronous or synchronous communications between your client application and the connected SAP CC system.

In synchronous communications, you can define a client-side timeout. A CommunicationFailureException is automatically thrown inside your client application if the connected SAP CC system does not reply to your request message before the timeout expires.

Use the asyncSend(..) and send(..) methods to manage the communications between your client application and the connected SAP CC system.

See Also:
CommunicationFailureException, BadMessageFormatException

Nested Class Summary
static interface MessageSender.IRedirectHandler
          This Java interface enables to be aware of HTTP redirection events in your client application.
 
Method Summary
 void addRedirectHandler(MessageSender.IRedirectHandler redirectHandler)
          Adds a redirection handler to this MessageSender; This handler is notified of redirection events.
 MessageContext asyncSend(MessageEnvelope env, ClientMessageListener listener)
          Sends a HCI message and receives notification of progress and upon termination of the message process via a dedicated listener.
 void removeRedirectHandler(MessageSender.IRedirectHandler redirectHandler)
          Removes a MessageSender.IRedirectHandler from this MessageSender; The handler is not be notified anymore of redirection events.
 MessageEnvelope send(MessageEnvelope env)
          Sends a HCI message and receives its results via the HCI technical interface; The communications are synchronous.
 MessageEnvelope send(MessageEnvelope env, int timeout)
          Sends a HCI message and receives its results via the HCI technical interface; this method is protected by a timeout, that means that, if the SAP CC system does not answer within the timeout, a communication failure is sent.
 

Method Detail

send

MessageEnvelope send(MessageEnvelope env)
                     throws CommunicationFailureException,
                            BadMessageFormatException
Sends a HCI message and receives its results via the HCI technical interface; The communications are synchronous.

Parameters:
env - The message to send
Returns:
The resulting message
Throws:
CommunicationFailureException - if the SAP CC system cannot be reached
BadMessageFormatException - if the message received is in a bad format

send

MessageEnvelope send(MessageEnvelope env,
                     int timeout)
                     throws CommunicationFailureException,
                            BadMessageFormatException
Sends a HCI message and receives its results via the HCI technical interface; this method is protected by a timeout, that means that, if the SAP CC system does not answer within the timeout, a communication failure is sent. Option: You can define a client-side timeout.

Parameters:
env - The HCI message to send
timeout - The timeout in millisecond (ms), a negative number means no timeout
Returns:
The resulting message
Throws:
CommunicationFailureException - if the SAP CC system cannot be reached or if the timeout expires
BadMessageFormatException - if the message received is in a bad format

addRedirectHandler

void addRedirectHandler(MessageSender.IRedirectHandler redirectHandler)
Adds a redirection handler to this MessageSender; This handler is notified of redirection events.

Parameters:
redirectHandler - The redirection event handler to add
See Also:
MessageSender.IRedirectHandler

removeRedirectHandler

void removeRedirectHandler(MessageSender.IRedirectHandler redirectHandler)
Removes a MessageSender.IRedirectHandler from this MessageSender; The handler is not be notified anymore of redirection events.

Parameters:
redirectHandler - The redirection event handler to remove

asyncSend

MessageContext asyncSend(MessageEnvelope env,
                         ClientMessageListener listener)
                         throws CommunicationFailureException,
                                BadMessageFormatException
Sends a HCI message and receives notification of progress and upon termination of the message process via a dedicated listener.

Parameters:
env - The HCI message to send
listener - A listener that will be notified of progress and upon termination of operations and message
Returns:
A message context that can be used to cancel the message or retrieve results
Throws:
CommunicationFailureException - if the SAP CC system cannot be reached
BadMessageFormatException - if the message is in a bad format

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)