Class EmgMessageParser
java.lang.Object
com.eqixiac.equinix.messaging.EmgMessageParser
Parses Equinix Messaging Gateway message bodies into typed
EmgMessages. Transport
agnostic: feed it the bytes of an AMQP message from any client. Thread-safe and stateless.
Tolerance
- Attribute names are matched case-insensitively; unknown attributes are ignored.
- Unknown enum values read as
UNKNOWN; timestamps without an offset are read as UTC; an unparseable timestamp reads asnull; numbers sent as strings are accepted. - Unescaped control characters inside strings are accepted (the documented IBX sample has a
line break inside
Signature). Task(andBody) may arrive as a JSON-encoded string rather than an object; Equinix's own Java template decodesTaskthat way, so both forms are accepted.- An unrecognised
Task.Resource, or a body that does not fit its resource's model, yields anUnknownNotificationrather than an error.
EmgParseException.
Routing
The message type is chosen fromTask.Resource as in the AsyncAPI spec's conditional
schemas, refined by body shape where the spec and the documented samples disagree:
DataCenter.Network.Port/.VirtualConnection with a Fabric-shaped body
(a data attribute) is a FabricNotification, otherwise a
NetworkNotification; an order-family resource whose body has LineDetails is a
BillingNotification, one with ActivityId an OrderNotification.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionparse(byte[] body) Parses a UTF-8 encoded message body.Parses a message body.
-
Constructor Details
-
EmgMessageParser
public EmgMessageParser()Creates a parser.
-
-
Method Details
-
parse
Parses a UTF-8 encoded message body.- Parameters:
body- the AMQP message body- Returns:
- the typed message, never
null - Throws:
EmgParseException- if the input is not an EMG envelope
-
parse
Parses a message body.- Parameters:
json- the message JSON- Returns:
- the typed message, never
null - Throws:
EmgParseException- if the input is not an EMG envelope
-