Message Hub message and event types
Supported message types
The Unit4 Message Hub (U4MH) routes messages from senders to receivers using message types as an overall classification. A message type describes its use cases and the header properties on the message reflect this. The following message types are currently supported:
- Document
- Message
Document events and Message events
Document events and Message events look similar, and the main difference between the two is that document messages come with a clear expectation regarding message content (body) and message header. On the other hand, message events can be used with greater freedom and the sender can add custom properties to the header, as well as defining its own content type and structure; or omitting content and sending messages using custom properties only as an information carrier.
Event type names
Event types are used to name events sent from a source system. Typically the name reflects the underlying business object that will trigger the event message to be sent. Note that the event type name is case insensitive. When sending the message, the EventType property of the message is forced to lowercase.
Scopes
Event types are scoped to the source system that registered the event type. This allows one or more source system to use the same event type name without conflict. For a subscriber it is important to know that, for example, U4BW.Customer
differs from U4SM.Customer
.
Versions
Event types can be versioned in case of schematic changes to custom properties or content. This allows event senders to do changes without affecting receivers. Versioning can be useful for message events carrying custom properties and content.
Note: The version is a string and will be empty when event types are registered without a version.
A more detailed overview of the different message types, their purpose and required message headers is provided below.
Document event message
- Holds an enterprise document
- Can be subscribed to
Message header properties
Property Name | Description | Sample values |
---|---|---|
MessageType | Message class | DocumentMessage (fixed) |
EventType | Business object that triggered the event. Should always be in lowercase. | customer, invoice, order, etc |
EventTypeVersion | Event type version | 1.0, v1.1, v2.0 (optional - can be empty) |
OperationType | Type of change that triggered the event | Added, Modified, Deleted |
SourceSystem | Originating product | U4BW, U4SM, etc |
TenantId | Customer identification key. Should always be in lowercase. | volvo, saab, toyota, etc. GUID allowed. |
EnterpriseKey | Global identifier for the object across all products | U4BW-Volvo-Customer-EN/130DEP1002 |
IsUsingStorage | Boolean. Flags if message content has been stored in tenant specific storage. | true/false |
Event message
- Purposed to coordinate actions across applications
- Can hold custom properties
- Can hold a document other than enterprise documents
- Can be subscribed to
Message header properties
Property Name | Description | Sample values |
---|---|---|
MessageType | Message class | EventMessage (fixed) |
EventType | Business object that triggered the event. Should always be in lowercase. | service-started, document-ready, etc |
EventTypeVersion | Event type version | 1.0, v1.1, v2.0 (optional - can be empty) |
OperationType | Type of change that triggered the event | Finished, Imported, Created (optional) |
SourceSystem | Originating product | U4BW, U4SM, etc |
TenantId | Customer identification key. Should always be in lowercase. | volvo, saab, toyota, etc. GUID allowed. |
IsUsingStorage | Boolean. Flags if message content has been stored in tenant specific storage. | true/false |
Message body (content)
The message body is used to send data along with the message properties. For Document events this is always a JSON document. For Event messages the body is defined by the sender.
The body itself is always a string. The sender uses the ContentType property to tell the receiver how to handle the body as it can be plain text or a base-64 encoded document, image, etc. It is the sender's responsibility to serialize the content to send and set the body.
Content type
Along with the body comes the ContentType property. The receiver uses this property to understand what is in the body and to be able to de-serialize it into its original format. Typically you set the ContentType property to the corresponding MIME-type of the body.