-
-
Notifications
You must be signed in to change notification settings - Fork 750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JMS, XMPP, ... (via AbstractBroadcasterProxy) : Broadcast to a specific resource #799
Comments
Hi to workaround, final Broadcaster tempBroadcaster = BroadcasterFactory.getDefault().lookup( UUID.randomUUID(), true );
tempBroadcaster.setBroadcasterLifeCyclePolicy( BroadcasterLifeCyclePolicy.EMPTY_DESTROY );
tempBroadcaster.addAtmosphereResource( resource );
tempBroadcaster.broadcast(message);
tempBroadcaster.addBroadcasterListener( new BroadcasterListener() {
@Override
public void onPreDestroy( Broadcaster b ) {
}
@Override
public void onPostCreate( Broadcaster b ) {
}
@Override
public void onComplete( Broadcaster b ) {
System.out.println( "remove temp broadcaster " );
tempBroadcaster.removeAtmosphereResource( resource );
}
} ); What do you think about ? |
No, that will create too many instance of Broadcaster. Instead, write a BroadcasterFilter and set the AtmosphereResource you want to discard before calling broadcast. The fix will be in 1.1, most probably during the week of Jan 23 |
Hi, Sorry I've already tested using a PerRequestBroadcastFilter. Unfortunately it does'nt work either. Broadcaster broadcasterAlerte = getBroadCaster();
PerRequestBroadcastFilter filter = new PerRequestBroadcastFilter() {
@Override
public BroadcastAction filter( Object originalMessage, Object message )
{
return new BroadcastAction(message );
}
@Override
public BroadcastAction filter( AtmosphereResource atmosphereResource,
Object originalMessage, Object message ) {
if (message!=null && message.toString().equals( "hello" ) ) {
System.out.println( "continue :" + atmosphereResource );
return new BroadcastAction( ACTION.CONTINUE, message );
}
else {
System.out.println( "abort :" + atmosphereResource );
return new BroadcastAction( ACTION.ABORT, message );
}
} };
broadcasterAlerte.getBroadcasterConfig().addFilter(filter);
broadcasterAlerte.broadcast("hello");
broadcasterAlerte.getBroadcasterConfig().removeFilter( filter); The output is : But the resource doesn't receive the message. Thanks a lot. Have a nice day. |
Ok, I won't fix that one as it requires to add some protocol on top of the communication channel used. The workaround is to broadcast the list of UUIDs to all node in the cluster, and use a BroadcastFilter to filter the one that needs to be invoked. I will add this issue to the FAQ. |
How do PrivateMessag send ? |
@abin103 You need to implements it yourself, as I described it many time on the mailing list. It not that compicated, I did it for Atmosphere Satellite What you need is add some kind of protocol and replicate the state of Atmosphere's uuid amongs the cluster. |
Hi
I'm using atmosphere to send messages to some gwt clients from the server (tomcat7).
So i call the method broadcaster.broadcast( String message, AtmosphereResource resourceA );
Has someone already test this method with jmsBroadcaster ?
Here is my conf.
The text was updated successfully, but these errors were encountered: