MessageSender

public abstract class MessageSender extends SOAPSender

The MessageSender is the abstract class which is used to send SOAP messsage request to B2B Collector series product.

Author:Joel Matsumoto, Twinsen Tsang

Fields

ps

protected Data ps

The partnership properties used for sending.

Constructors

MessageSender

public MessageSender(FileLogger l, Data m, Data p)

Explicit Constructor.

Parameters:
  • l – The logger used for log message and exception.
  • m – The message properties including how many message need to be sent and some performance parameter.
  • p – The partnership properties used for sending.

Methods

addRequestPayload

public boolean addRequestPayload(Payload[] payloads)

Add a set of payloads to the SOAP Request. The payloads are attached in the attachment part in the SOAP Message.

Parameters:
  • payloads – The array of payload.
Returns:

true if payloads is added succesfully.

clearRequestPayload

public boolean clearRequestPayload()

Clear all payload in the request.

getContentType

public String getContentType()

Return the content type of the message.

Returns:The content type of message to bes sent.

getElapsedTime

public long getElapsedTime()

Get how long it tasks for the sender to do it’s tasks.

Returns:The times for the task from start to end in milleseconds.

getEndTime

public long getEndTime()
Returns:Return the end time of the sender process.

getResponsePayloads

public Payload[] getResponsePayloads()

Get the payload from the SOAP response. This should be called during onResponse().

Throws:
  • SOAPException – When unable to extract the payload in the SOAP Response.
  • IOException – When unable to open the input stream for the payload.
Returns:

A set of payload in SOAP message.

getStartTime

public long getStartTime()
Returns:Return the start time of the sending process.

onEnd

public void onEnd()

[@EVENT] This method is invoked when the sending execution is ended.

onError

public void onError(Throwable t)

[@EVENT] Log all known exceptions and stack trace.

Parameters:
  • t – The exception encountered.

onStart

public void onStart()

[@EVENT] This method is invoked when the sender begins to execute the run method.

setContentType

public void setContentType(String contentType)

Set the content type of the message to be sent.

Parameters:
  • contentType – The content type of message to be sent.