-
Aug 15th, 2009, 05:38 AM
#1
Get attributes(events of channel) when subscibers connect/disconnect
Hi,
I have a requirement where in i want to get notification when the first subscriber hooks(may be with some service activator) into the channel .
Also i need notifications when the last subscriber unregisters from the channel.
That is, I want notification when the number of listeners on channel becomes 1 or 0 ? This is because when first guy subscribers to this channel i want some jms adapter to get activated ,similarly when the last guy unsubscribes i want to dynamically stop the jms adapters.
Currently i am using AOP to get subscriber on pub-sub-channel. But i have to take the additional pain of maintaining the count of the subscribers .
@Pointcut("execution(* org.springframework.integration.channel.Subscribab leChannel.subscribe(..))")
private void subscribe() {
}
@Before("subscribe() &&" + "args(arg) &&" + "this(channel)")
public void beforeAdvice(MessageHandler arg,MessageChannel channel)
{
........
}
Is there any internal property of the channel which i can use for all the above mentioned cases and dynamically start stop adapters connected to it ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules