div | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||
|
Overview
This page assumes you have read Working with Messaging to understand the basics of SMA messaging
Dispatch of Messages
Note |
---|
TODO diagram describing flow |
Message Acknowledgement
Note |
---|
TODO diagram describing flow |
Expressing Interest
Channel Filters
A channel filter filters variable parts of a channel key to filter what is received over the channel.
Unless otherwise specified by a particular channel implementation, a channel filter takes the following form: var1=val1[|val2][;var2=val3]
For example: given a channel key of "ORDERS/${Region}/{Department}"
, one can specify a channel filter of "Region=NA|EMEA;Department=Clothing"
. This would join the channel on:
- ORDERS/NA/Clothing
- ORDERS/EMEA/Clothing
If a variable portion of the channel key is omitted in a filter, it will result in the subscription being joined in a wildcard fashion (assuming the underlying bus implementation supports wildcards). So given a channel key of "ORDERS/${Region}/${Department}"
and a channel filter of "Region=NA|EMEA"
, it would result in the following subscriptions being issued during join:
- ORDERS/NA/*
- ORDERS/EMEA/*
Finally, if the channel filter is set to null for the channel key in the example above, then the resulting subscription would be:
- ORDERS/*/*
Registering Message View Factories
Message bus binding implementations receive messages in serialized form and wrap them with a MessageView that is passed to the application to work with. MessageViews are wrapped by locating the message MessageViewFactory for the message which is typically generated by ADM. To locate the factory and message type a binding consults Message Metadata that is transported along with the serialized message. An application must therefore register the message factories it intends to use so that bus binding can find the factories. This can be done in 2 ways:
Registration via Config DDL
Most often, applications will list message view factories that they use in their DDL Config:
Code Block | ||||
---|---|---|---|---|
| ||||
<apps>
<app name="MyApp">
<messaging>
<factories>
<factory name="com.example.messages.MyMessageFactory" />
<factory name="com.example.messages.other.MyOtherMessageFactory" />
</factories>
</messaging>
</app>
</app> |
Programmatically
Registration can also be done programmatically via the AepEngine. A common way to do this is to provide an AppInjectionPoint for the AepEngine in the application:
Code Block | ||||
---|---|---|---|---|
| ||||
public class MyApp {
@AppInjectionPoint
public void onEngineCreated(AepEngine engine) {
engine.registerFactory(new com.example.messages.MyMessageFactory());
engine.registerFactory(new com.example.messages.other.MyOtherMessageFactory());
}
} |
Preserving Subscriptions on Shutdown
See Also