Use NCache Messaging for Runtime Data Sharing

Many applications today need to share data with each other at runtime asynchronously. And, relational databases do not provide an efficient event notification mechanism and their performance and scalability is a major concern.

Message queues provide sequenced messages and guarantee message delivery but they also have performance and scalability issues.

The best way is to use a message bus style messaging platform that is fast and scalable and also provides producer/consumer style data sharing coordination. NCache is an extremely fast and scalable distributed cache and also provides a simple and powerful message bus style messaging capability.

With NCache messaging, you can do the following:

Cache level events: NCache can notify clients on add, insert, and remove of any item in the cache or if the cache is cleared, if the client has registered interest in receiving such events.

Item level events: NCache can notify clients on a specific item update and remove if the client has registered interest in it.

Continuous Query events: NCache can monitor a dataset in the cache based on SQL-like criteria and then notify clients for add, update, and remove of items from this data set to clients who have registered interest in it.

Application initiated custom events: Applications can fire custom events into NCache message bus so other applications who have registered interest in them can be notified.

All the applications (whether .NET or Java) connected to NCache can use it as a messaging platform and propagate events through it to other applications. Or, they can ask the cache to notify them when certain things happen in the cache.

Cache Level Events

Cache level events are fired whenever anything is added, updated, or removed or if the cache is cleared from the cache. By default, these events are turned off because they can get quite chatty. But, you can enable some or all of them in the cache configuration and then have your application supply callback functions to NCache so NCache calls these callbacks when these events occur. Below are the type of callbacks you can register.

Continuous Query

Continuous Query is a powerful feature of NCache that allows you to register an SQL-like query with the cache and also specify for which events would you like your callbacks to be called by NCache.

NCache then creates a Continuous Query in the cache cluster and monitors all add, update, and remove operations to see if they modify cached items matching this Continuous Query criteria. If so, then NCache notifies your client application about it.

Application Initiated Custom Events

NCache allows your applications to coordinate with other in a producer/consumer or publish/subscribe scenario. One application produces data and then fires a custom event into NCache messaging and one or more applications are waiting to receive this event.

Here is how your application registers to receive these custom events.