|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Processor
Encapsulates both the client and server roles of the HL7-defined "original mode" and "enhanced mode" processing rules. See HL7 v2.5 chapter 2 for specifications.
Field Summary | |
---|---|
static java.lang.String |
AA
Original mode: Application Accept - Enhanced mode: Application acknowledgment: Accept |
static java.lang.String |
AE
Original mode: Application Error - Enhanced mode: Application acknowledgment: Error |
static java.lang.String |
AL
Always send acknowledgement (in MSH-15 and 16) |
static java.lang.String |
AR
Original mode: Application Reject - Enhanced mode: Application acknowledgment: Reject |
static java.lang.String |
CA
Enhanced mode: Accept acknowledgment: Commit Accept |
static java.lang.String |
CE
Enhanced mode: Accept acknow ledgment: Commit Error |
static java.lang.String |
CR
Enhanced mode: Accept acknowledgment: Commit Reject |
static java.lang.String |
ER
Send acknowledgement only on error / reject (in MSH-15 and 16) |
static java.lang.String |
NE
Never send acknowledgement (in MSH-15 and 16) |
static java.lang.String |
SU
Send acknowledgement only on successful receipt (in MSH-15 and 16) |
Method Summary | |
---|---|
void |
cycle(boolean expectingAck)
Performs a single iteration of the receiving-side of the HL7 original mode or enhanced mode processing rules (see HL7 Standard v2.5 Chapter 2; the choice of rules is determined by message values). |
ProcessorContext |
getContext()
|
boolean |
isAvailable(java.lang.String theAckId)
|
Transportable |
receive(java.lang.String theAckId,
long theTimeoutMillis)
Gets the message with the given acknowledgement ID from the incoming message list. |
void |
reserve(java.lang.String theAckId,
long thePeriodMillis)
Indicates that the calling thread expects a message with a certain ack ID. |
void |
send(Transportable theMessage,
int maxRetries,
long retryIntervalMillis)
Sends a message to a remote system via an underlying TransportLayer . |
Field Detail |
---|
static final java.lang.String AL
static final java.lang.String NE
static final java.lang.String ER
static final java.lang.String SU
static final java.lang.String AA
static final java.lang.String AE
static final java.lang.String AR
static final java.lang.String CA
static final java.lang.String CE
static final java.lang.String CR
Method Detail |
---|
void send(Transportable theMessage, int maxRetries, long retryIntervalMillis) throws HL7Exception
TransportLayer
.
If the message specifies that an accept ACK is required (under enhanced mode
processing rules) then this method may retry if transmission does not appear
to be successful. The call to this method blocks while this is happening.
Retries are attempted if a CR message is received, or if no message is received
in the specified time frame. If a CE is received, an exception is thrown. If
a CA is received, the call returns quietly.
If no accept ack is required, this method returns immediately after attempting to
send a message, throwing an exception only if there is an immediate problem (eg the
server can't be contacted).
If an accept ack is required only on error, the method waits for maxRetries *
retryItervalMillis for an error to be returned, and assumes that there is no error
if none appears in that time. The message is not actually resent while waiting for an
error ACK.
theMessage
- the message to sendmaxRetries
- note that this should be a small value if you demand an accept ack only
on errorretryIntervalMillis
- note that this should be a small value if you demand an accept ack only
on error
TransportException
- if there is an immediate problem trying to send the
message.
HL7Exception
void reserve(java.lang.String theAckId, long thePeriodMillis)
Application
. If a message is in this list it isAvailable()
and can be had via receive()
theAckId
- the acknowledgement ID of the messagethePeriodMillis
- time span during which the message should be kept if receivedvoid cycle(boolean expectingAck) throws HL7Exception
Performs a single iteration of the receiving-side of the HL7 original mode or enhanced mode processing rules (see HL7 Standard v2.5 Chapter 2; the choice of rules is determined by message values). Steps in the process are as follows:
1. TransportLayer.receive() is called to get the next message
expectingAck
- is passed to TransportLayer.receive(), and may determine
where the message is read from (eg different sockets may be used for
commit-level ACKs). Note that this call blocks until a message is ready
at the specified location, so to run the Processor continuously,
separate threads are needed to call cycle() with true and false args.
HL7Exception
boolean isAvailable(java.lang.String theAckId)
theAckId
- the acknowledgement ID of an expected message
Transportable receive(java.lang.String theAckId, long theTimeoutMillis) throws HL7Exception
isAvailable()
to see if it is there.
Note also that the message has no way of arriving on the list
during this call unless the Processor
is running
as a thread, or unless some other thread is calling cycle().
theAckId
- theTimeoutMillis
- milliseconds until the call times out
and returns null if the desired message is not available.
HL7Exception
ProcessorContext getContext()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |