3

There are endless resources on creating CRUD for REST resources but I can't find much on doing the same for Messaging.

Given two services A and B where A receives incoming requests that initiates the creation of the resource R. When A receives the request it does some processing and creates R and then wants to store R in B using JMS. After creation, the Read/Update/Delete operations should be available on R.

I can see a couple of different approaches here:

  1. Use a generic entity that contains an operation (crud) and some generic object that can be cast to R if updating, and to id(R) if reading or deleting. The entity is published on a common queue Q.

  2. Use strictly typed entities for the different operations where each operation is published on its own queue Qc, Qr, Qu, Qd.

  3. Use strictly typed entities for the different operations where each operation is published on the same queue Q but with different type.

From my understanding of JMS it is usually recommended to use separate queues for different types of messages to avoid congestion-issues where one type of message can block for all others.

Does this mean the CRUD operations should have separate queues or should they be considered to handle the same type of resource and thus share a queue?

  • I don't see what CRUD has to do with this. – Robert Harvey Jan 19 '18 at 15:54
  • @RobertHarvey CRUD is just an example used to reason about a collection of operations that share a resource. Each CRUD operation have different needs (Create needs the Resource, Read needs the ID, Update needs the ID and a Resource and Delete needs the ID). This means the entities passed on the queue(s) are different since they require different attributes. Does it make sense to split such operations onto different queues or should they be kept together since they all operate on the same Resource. – span Jan 19 '18 at 17:55
  • I don't see any good reason to put these on separate queues unless you can't put the "different needs" in the same queue. This is probably YAGNI; use one queue until you identify a contention issue that needs to be solved with multiple queues. – Robert Harvey Jan 19 '18 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.