Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inventory synchronization using JMS interfaces

 
Teja Saab
Rancher
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to create the architecture for a system that has an inventory system as one of its components. Assuming that the inventory system contains inventory levels for products manufactured by different companies, I am trying to find the best way to keep the inventory system up to date with the different manufacturer inventory levels. Each one of the manufacturer's systems supports a JMS interface.

The inventory data in the inventory system is used in a B2C site. So response time is important. Sending a JMS message to a manufacturer in real time to find out available inventory while a customer is waiting for the web page to update is not an option.

I am thinking of an inventory synchronization approach with two MDBs. The first MDB registers itself with the EJB container's timer service.
The timer can be set to fire every few seconds or minutes. When the timer is fired, the timer callback method in the MDB will send a request message to each one of the manufacturers incoming queues. The manufacturer will reply back with the availability to the replyTo queue. The second MDB configured to listen on the replyTo queue will process the incoming message and update the inventory system. The B2C site always interacts with the local InventoryManager class which will in turn talk to the local inventory management system. In other words, the InventoryManager class decouples the external manufacturer interfaces from the rest of the application thereby promoting loose coupling.

What do you folks think about this approach?

Thanks for your inputs and critiques.
 
Suresh Gokarakonda
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
some thoughts on this,

1) Scenario in which a update to your inventory system happens with in the cache expiry time
how critical is it to show the as is data?
2) If the cache expiry time is very small(sort of solving above question) after a period of time in production
some inventory products which are no longer used by users (may be some obsolete or rarely used) would still be part of your cache
and increase the load your down stream system in terms of requests comming in.


whats the time taken by your downstream systems to respond to requests?
1) If its <10 seconds and showing as is data is critical
probably i would put some interceptors to first call and send in the request to downstream system parallelly
 
shyam paleti
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The manufacturers should provide publish/subscribe jms interface. So, whenever there is update to inventory at manufactures end, it gets reflected in the B2C site and can be picked up by local inventory manager.

 
Maverick Grotto
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Teja Saab wrote:I am trying to create the architecture for a system that has an inventory system as one of its components. Assuming that the inventory system contains inventory levels for products manufactured by different companies, I am trying to find the best way to keep the inventory system up to date with the different manufacturer inventory levels. Each one of the manufacturer's systems supports a JMS interface.

The inventory data in the inventory system is used in a B2C site. So response time is important. Sending a JMS message to a manufacturer in real time to find out available inventory while a customer is waiting for the web page to update is not an option.

I am thinking of an inventory synchronization approach with two MDBs. The first MDB registers itself with the EJB container's timer service.
The timer can be set to fire every few seconds or minutes. When the timer is fired, the timer callback method in the MDB will send a request message to each one of the manufacturers incoming queues. The manufacturer will reply back with the availability to the replyTo queue. The second MDB configured to listen on the replyTo queue will process the incoming message and update the inventory system. The B2C site always interacts with the local InventoryManager class which will in turn talk to the local inventory management system. In other words, the InventoryManager class decouples the external manufacturer interfaces from the rest of the application thereby promoting loose coupling.

What do you folks think about this approach?

Thanks for your inputs and critiques.


My thoughts on this.
1. Your solution assumes that the manufacturer jms implementation will utilize the "replyTo" attribute of the JMS message that the B2C site will send.
2. The entire conversation between the B2C site and the manufacturers is too chatty.
3. JMS by nature promotes loose coupling. So in this case, if your solution just subscribes to the manufacturers TOPIC (or listens to the manufacturer provided QUEUE name), you should be good.


 
Teja Saab
Rancher
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Suresh, Shyam and Maverick for your valuable inputs. You are right Maverick that I cannot assume that the partner's implementation uses the replyTo queue to send responses.

I thought about the publish/subscribe approach. However, one of the issues that I am trying to figure out is how to avoid the inventory data from being stale. Let me explain.

(1). Each one of the manufacturers probably have several different partner B2C sites that sell their stuff. Also assuming that the manufacturers publish their inventory data using a publish/subscribe mechanism to all partners, it is just a matter of time before my inventory data becomes stale.

For example, Manufacturer 1 publishes inventory 500 for product p1 to 10 different web sites including the one that I am architecting. I update my system with inventory 500 for product p1. However, another B2C site probably makes a sale of 200 items before me and that reduces the manufacturer's inventory to 300 now. However, my inventory is still showing as 500 (assuming that the next publish is yet to come from the manufacturer). If I make a sale for 400 items, I won't be able to fulfill the order since the available quantity is only 300.

(2). The manufacturer will not know what product's inventory levels my B2C site is interested in. The manufacturer might be manufacturing 10000 items, but I might be selling only 10 of them through the B2C site. So I need the inventory levels of only those 10 items. I understand that I can use JMS selectors (filters) to only get what I am interested in. However, that still requires 100 percent of the messages to be processed on my end and then 99.99 percent discarded due to the selection criteria not being met.

I am thinking of a simpler approach where I stock stuff from the different manufacturers in my own warehouse where I would have complete control over the inventory. In case of a large order which exceeds the amount that I have in the warehouse, the order will be confirmed by email after checking and reserving inventory with the manufacturer.

It is probably not very optimal from an end user's approach since the user of the site would probably want to know in real time if his order will be fulfilled.
 
Maverick Grotto
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Teja Saab wrote:Thank you Suresh, Shyam and Maverick for your valuable inputs. You are right Maverick that I cannot assume that the partner's implementation uses the replyTo queue to send responses.

I thought about the publish/subscribe approach. However, one of the issues that I am trying to figure out is how to avoid the inventory data from being stale. Let me explain.

(1). Each one of the manufacturers probably have several different partner B2C sites that sell their stuff. Also assuming that the manufacturers publish their inventory data using a publish/subscribe mechanism to all partners, it is just a matter of time before my inventory data becomes stale.

For example, Manufacturer 1 publishes inventory 500 for product p1 to 10 different web sites including the one that I am architecting. I update my system with inventory 500 for product p1. However, another B2C site probably makes a sale of 200 items before me and that reduces the manufacturer's inventory to 300 now. However, my inventory is still showing as 500 (assuming that the next publish is yet to come from the manufacturer). If I make a sale for 400 items, I won't be able to fulfill the order since the available quantity is only 300.


The true inventory resides with the manufacturer. All the other B2C sites show only a snapshot of this "true" inventory. These snapshot inventories are bound to become stale if they are trying to poll the manufacturers inventory on some sort of a timer. The best solution seems to be when the manufacturer utilizes an event driven publishing scheme in which any change in inventory is published to all the subscribers in realtime. Even with this scenario, there is a window of opportunity for stale data being utilized for processing. The only way around this seems to be to validate against the "true" inventory data before using it.

Reserving part of the inventory (as you hinted in your last post) from the manufacturer would definitely help out on the data synchronization front.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic