jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niall Gallagher <ni...@switchfire.com>
Subject Re: Add listener to LateralTCPCache
Date Fri, 09 Jun 2006 11:19:48 GMT
Hi Phineas,

I think perhaps you are using the wrong technology to solve your
problem. JCS is designed for caching data, not routing data.

Take a look at JMS Java Messaging Service. It is specifically designed
for data transport, queueing, and is based around event listeners.

Some research on your part is warranted. If you demonstrate that you
have done your homework and give reasons why you want to use JCS versus
JMS for example to solve your problem then you will likely get more
support from members on this mailing list.

That said, perhaps JCS does support event listeners. I don't know.

I suspect that if distributed event notification is not listed in JCS'
list of features (and it's not) then it's not supported.
http://jakarta.apache.org/jcs/ElementEventHandling.html seems to discuss
local cache events, but I don't think that's what you're looking for.

I don't think event listeners are really applicable to a caching system
in most cases actually.

The procedure for retrieving data from a cache in general is:
1. Check if the data is in the cache
2. If it is there, use the cached data
3. If it is not, load the data, add it to the cache, and then use the
data
4. Subsequent requests for the same data will then be obtained from the
cache

Item (1) is a polling operation, it is not event driven. The client
application knows when it needs data, and so checks the cache for it.
The cache does not tell the application when it has new data available.
Such an architecture is a message delivery system, not a cache.

If you simply must use JCS as a message delivery mechanism, I suggest
you set up a polling thread in your client application, which
periodically checks if new data has been added to the cache, and if so
calls some method in your application to handle it. This being a
non-standard use of JCS caching however, members of this mailing list
might not be able to give much advice on it.

Anyway. I hope this helps.

Niall

On Fri, 2006-06-09 at 15:59 +0800, Phineas Fung wrote:

> Hi all,
> 
> I'm writing a client-server application.  Server continuously writes data to
> a LTCP cache, while client (on another machine) continuously consume it.
> 
> My questions are:
> - Can JCS notify my client class that new data are available in cache?
> - Is there a LTCP cache listener that my client class can implement?
> - Who this listener interface should register to to receive data change
> notification event?
> 
> Would be very much grateful if you can point me to some sample source code.
> 
> Thanks alot.
> 
> 
> Best Regards,
> Phineas Fung
> 
> Here's part of my cache.ccf
> 
> jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPCac
> heFactory
> jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.socket.tcp.TC
> PLateralCacheAttributes
> jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1110
> jcs.auxiliary.LTCP.attributes.TcpListenerPort=1111
> jcs.auxiliary.LTCP.attributes.AllowGet=false
> jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=false
> 
> jcs.region.DistributedData=LTCP
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message