Package ca.uhn.hl7v2.protocol
Interface ApplicationRouter
- All Known Implementing Classes:
ApplicationRouterImpl
public interface ApplicationRouter
Routes messages to the appropriate application.
- Author:
- Bryan Tripp
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceEncapsulates the message fields used for routing of messages from the HL7 protocol to the appropriateApplication. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMetadatakey: Charset (MSH-18)static final StringMetadatakey: Message control ID (MSH-10)static final StringMetadatakey: Provides the IP of the sending system for a given messagestatic final StringMetadatakey: Provides the port of the sending system for a given message -
Method Summary
Modifier and TypeMethodDescriptionvoidbindApplication(ApplicationRouter.AppRoutingData theRoutingData, ReceivingApplication<? extends Message> theApplication) Associates the given application with the given message parameters, so that messages with matching parameters will be sent there.voiddisableBinding(ApplicationRouter.AppRoutingData theRoutingData) Temporarily deactivates the binding on the given field data, if present.voidenableBinding(ApplicationRouter.AppRoutingData theRoutingData) UndoesdisableBinding(AppRoutingData theRoutingData).booleanhasActiveBinding(ApplicationRouter.AppRoutingData theRoutingData) processMessage(Transportable theMessage) Attempts to route the given message to the associatedApplicationand obtain a response.voidsetExceptionHandler(ReceivingApplicationExceptionHandler exceptionHandler) Sets an exception handler which will be invoked in the event of a failure during parsing, processing, or encoding of an incoming message or its response.booleanunbindApplication(ApplicationRouter.AppRoutingData theRoutingData) Removes the binding for the given message parametersbooleanunbindApplication(ReceivingApplication<? extends Message> theApplication) Removes the binding for the given message parameters
-
Field Details
-
METADATA_KEY_MESSAGE_CHARSET
Metadatakey: Charset (MSH-18)- See Also:
-
METADATA_KEY_MESSAGE_CONTROL_ID
Metadatakey: Message control ID (MSH-10)- See Also:
-
METADATA_KEY_SENDING_IP
Metadatakey: Provides the IP of the sending system for a given message- See Also:
-
METADATA_KEY_SENDING_PORT
Metadatakey: Provides the port of the sending system for a given message- See Also:
-
-
Method Details
-
processMessage
Attempts to route the given message to the associatedApplicationand obtain a response.- Parameters:
theMessage- the message to route- Returns:
- the response message (this may be null, for example if the given message doesn't require an application ACK)
- Throws:
HL7Exception
-
hasActiveBinding
- Parameters:
theRoutingData- message fields used in determining the appropriate destination- Returns:
- true if there is a destination application for messages with the given characteristics
-
bindApplication
void bindApplication(ApplicationRouter.AppRoutingData theRoutingData, ReceivingApplication<? extends Message> theApplication) Associates the given application with the given message parameters, so that messages with matching parameters will be sent there. Only one application can be registered for a given set of parameters: repeated registration for a particular combination over-writes the previous one.
Because of wildcards, there may be multiple registrations that match a given message. In this case, the first registered wins.
- Parameters:
theRoutingData- message fields used in determining the appropriate destinationtheApplication- the application to which messages with these parameters should be sent
-
unbindApplication
Removes the binding for the given message parameters- Parameters:
theRoutingData-- Returns:
- true if an application was unbound, false otherwise
-
unbindApplication
Removes the binding for the given message parameters- Parameters:
theApplication-- Returns:
- true if an application was unbound, false otherwise
-
disableBinding
Temporarily deactivates the binding on the given field data, if present.- Parameters:
theRoutingData- the fields that define a set of messages that are bound to someApplication
-
enableBinding
UndoesdisableBinding(AppRoutingData theRoutingData).- Parameters:
theRoutingData- the fields that define a set of messages that are bound to someApplication
-
getParser
- Returns:
- the
Parserthat is used to parse inbound messages and encode outbound ones. It may be of interest to set certain parameters of this parser.
-
setExceptionHandler
Sets an exception handler which will be invoked in the event of a failure during parsing, processing, or encoding of an incoming message or its response.
-