-
Notifications
You must be signed in to change notification settings - Fork 7
03. Module: Messaging
vdakker edited this page Aug 6, 2021
·
3 revisions
Can be included as a dependency:
<dependency>
<groupId>de.fraunhofer.ids.messaging</groupId>
<artifactId>messaging</artifactId>
<version>IDS_MESSAGING_SERVICES_VERSION</version>
</dependency>
- All functionalities for sending and receiving IDS-Messages independent of specific infrastructure components.
- Provides the idsHttpService, which can be used to send IDS-Messages to arbitrary endpoints, but the specific message-types itself must be built individually.
- Contains the core-module as dependency and is included by the infrastructure-modules as dependency.
- The individual infrastructure-modules, in turn, provide pre-built functionalities so that the specific message-types do not have to be built individually and the idsHttpService doesn't need to be used for them to send messages.
- Specifies default endpoints for incoming IDS-Messages (/api/ids/data, /api/ids/infrastructure)
- Endpoints can be changed at runtime
- Checks if infomodel-version of incoming message is supported by Connector and Core-DAT-Check
- Provides interface for additional filters for incoming messages
- Provides interface for MessageHandler to be implemented by the Connector for specific message types
- IdsHttpService as a way to send arbitrary IDS-Messages without specific Component-Context
- Set individual Timeouts for connection & call at runtime
- Standard-Response classes (BodyResponse, ErrorResponse)
To handle IDS Multipart messages, MessageHandlers have to be created. The messaging services provide two types of message handlers: MessageHandler and MessageAndClaimsHandler.
A MessageHandler, gets the IDS message header as an infomodel Message
object and the payload as an instance of MessagePayload
.
@SupportedMessageType(RequestMessageImpl.class)
public class RequestMessageHandler implements MessageHandler<RequestMessageImpl> {
@Override
public MessageResponse handleMessage( final RequestMessageImpl queryHeader,
final MessagePayload payload) {
//Your message handling here.
}
}
The MessageAndClaimsHandler also gets the Jws<Claims>
of the DAT Token (which is a JWT Token) of the incoming message.
@SupportedMessageType(NotificationMessageImpl.class)
public class NotificationMessageHandler implements MessageAndClaimsHandler<NotificationMessageImpl> {
@Override
public MessageResponse handleMessage(final NotificationMessageImpl queryHeader,
final MessagePayload payload, final Optional<Jws<Claims>> claimsJws) throws MessageHandlerException {
//Your message and claims handling here.
}
}