Here are a few useful practices that will facilitate systematic reuse when using message publications:
- Organize publication topics by a domain relevant hierarchy – this will help cater to subscribers that are interested in fine grained messages as well as those who want an entire set of related publications.
- Version publications – if one publication can send multiple types of business/data entities, version them as well.
- Separate publication into a header and business payload section. This will help you write utilities that can examine the header and take action – e.g. display any publication as XML, report on a variety of metrics etc.
- Reuse xml schema contracts that are used in your web service API as much as possible in the business payload publications. This will reduce the programming and integration effort for your consumers. They can reuse the same code regardless of whether a message came as a reply or sent as a publication.
- Support multiple data formats – not all your consumers might want XML. Some might prefer delimited text or fixed length messages. Your services platform can publish the same message in multiple data formats across topics – e.g. com.yourcompany.messaging.customer_v1_0.XML and com.yourcompany.messaging.customer_v1_0.FIXED_LENGTH
These are some of the guidelines I have used. Have you used additional ones to facilitate reuse?