public class ActiveInitiator extends Object implements Initiator
Performs the initiation role of a message exchange (i.e sender of the first message; analogous to the client in a client-server interaction), according to HL7's original mode processing rules.
The sendAndReceive(...) method blocks until either a response is
received with the matching message ID, or until a timeout period has passed.
The timeout defaults to 10000 ms (10 sec) but can be configured using
setTimeout(long, java.util.concurrent.TimeUnit) or globally by setting
the system property "ca.uhn.hl7v2.app.initiator.timeout" to an long value
representing the number of ms after which to time out.
At the time of writing, enhanced mode, two-phase reply, continuation messages, and batch processing are unsupported.
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args)
Test harness
|
Message |
sendAndReceive(Message out)
Sends a message to a responder system, receives the reply, and returns
the reply as a Message object.
|
void |
setTimeout(long timeout,
TimeUnit timeUnit)
Sets the time that the initiator will wait for a
response for a given message before timing out and throwing an exception
(default is 10 seconds).
|
void |
setTimeoutMillis(int timeout)
Sets the time (in milliseconds) that the initiator will wait for a
response for a given message before timing out and throwing an exception
(default is 10 seconds).
|
public Message sendAndReceive(Message out) throws HL7Exception, LLPException, IOException
sendAndReceive in interface Initiatorout - outgoing messageHL7ExceptionLLPExceptionIOExceptionpublic void setTimeoutMillis(int timeout)
InitiatorsetTimeoutMillis in interface Initiatortimeout - time in millisecondspublic void setTimeout(long timeout, TimeUnit timeUnit)
InitiatorsetTimeout in interface Initiatortimeout - time durationtimeUnit - time unitCopyright © 2001-2014 University Health Network. All Rights Reserved.