Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Event Services

An event service is a named container for business event messages. It defines the contract between publishers and consumers: what events exist and what data each event carries.

CREATE BUSINESS EVENT SERVICE

CREATE BUSINESS EVENT SERVICE <Module>.<Name> (
  [Version: '<version>',]
  [Description: '<text>']
) {
  MESSAGE <MessageName> (
    <AttributeName>: <Type> [, ...]
  )
  [MESSAGE <MessageName> ( ... )]
};
ElementDescription
VersionService version string
DescriptionHuman-readable description of the service
MESSAGEA named event type with typed attributes

Attribute Types

Message attributes support standard Mendix types:

TypeDescription
StringText value
Integer32-bit integer
Long64-bit integer
DecimalPrecise decimal number
BooleanTrue or false
DateTimeDate and time value

Example

CREATE BUSINESS EVENT SERVICE HR.EmployeeEvents (
  Version: '2.0',
  Description: 'Employee lifecycle events'
) {
  MESSAGE EmployeeHired (
    EmployeeId: String,
    FullName: String,
    Department: String,
    StartDate: DateTime
  )
  MESSAGE EmployeeTerminated (
    EmployeeId: String,
    TerminationDate: DateTime,
    Reason: String
  )
};

DROP BUSINESS EVENT SERVICE

Remove an event service:

DROP BUSINESS EVENT SERVICE HR.EmployeeEvents;

Listing and Inspecting

-- List all services
SHOW BUSINESS EVENTS;

-- Filter by module
SHOW BUSINESS EVENTS IN HR;

-- Full MDL definition
DESCRIBE BUSINESS EVENT SERVICE HR.EmployeeEvents;

The DESCRIBE output is round-trippable – it can be copied, modified, and executed as a CREATE statement.

See Also