From my understanding on cometd
> Why should I declare the BayeuxServer in the application.xml if it
> already defined in the CometdServlet?
Because the BayeusServer in CometdServlet is just a fallback one which
will be created for "generic" purpose if the servlet finds no
"specific" server instance in servlet context. You inject the a
bayeusServer into your spring's controller bean. If you don't declare
BayeusServer as a bean in spring context, there is no way for spring
to inject it. And since by defining a BayeusServer instance in spring
context, you need to tell CometdServlet to use that specfic
BayeusServer instance, that why you need a
ServletContextAttributeExporter as shown in the document.
Have you create a BayeusServer yet in your POC? If not, lets create
one as shown in the document.
For the annotation part, have you create a "Configurer" bean, which
receives a bayeux server and instantiates a ServerAnnotationProcessor.
I think, without ServerAnnotationProcessor, there is no way for cometd
annotation to be understood. I haven't try cometd annotation yet. And
I wonder if the example about the Configurer bean in the document
works as in the 'public BayeuxServer bayeuxServer()" method, it
creates a new BayeusServer server instance instead of reusing the
injected BayeusServer. So lets try as-is with the example in the
document, if doesn't work, try to reuse the injected BayeusServer :)
Hope it helps,
Bao.
> --
> You received this message because you are subscribed to the Google Groups "cometd-users" group.
> To post to this group, send email to cometd...@googlegroups.com
> To unsubscribe from this group, send email to cometd-users...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/cometd-users
>
> Visit the CometD website at http://www.cometd.org
On Mon, Feb 6, 2012 at 08:48, iram lewinger <iramle...@gmail.com> wrote:
> No I'm struggling with generating a correct ServerMessage.Mutable in the
> controller and sending it back to the JsonRestStore in the client.
> My current store looks like:
> [{"index":"1","value":"first"},{"index":"2","value":"second"}]
> The definition of the data store in the client side is:
> var dataStore = new dojox.data.JsonRestStore({target:
> "apps/testNotificationTable/json/", idAttribute: "index"});
> The subscription of the data store to notification is:
> dojox.cometd.subscribe("/apps/testNotificationTable/json/", function(msg){
> dojox.data.restListener({
> channel: msg.data.channel,
> event: msg.data.data.event,
> result: msg.data.data.result
> });
> });
Bayeux channels should not end with "/". If you need wildcard
subscription, use "/apps/testNotificationTable/json/*".
That's probably the problem. Let us know if that worked.
Simon
--
http://cometd.org
http://intalio.com
http://bordet.blogspot.com
----
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless. Victoria Livschitz
On Mon, Feb 6, 2012 at 17:13, iram lewinger <iramle...@gmail.com> wrote:
> Hi Simon,
>
> I've managed to receive the notification at client side after removing "/"
> from the beginning of the channel attribute of the ServerMessage:
> Mutable newMessage = bayeux.newMessage();
> newMessage.setChannel("apps/testNotificationTable/json/");
> Instead of:
> newMessage.setChannel("/apps/testNotificationTable/json");
>
> Now I'm facing with a weird issue where after the first time that I'm
> performing the Server notification, meaning getting the channel from the
> BayeuxServer, every next bayeux.getChannel(channel) execution ends with NULL
> value:
> String channel = "/apps/testNotificationTable/json";
> ServerChannel serverChannel = bayeux.getChannel(channel);
>
> Why is that?
The server aggressively sweep channels to free memory.
To avoid that, you need to either make the channel persistent or to
add a listener to it.
To make a channel persistent you do:
bayeuxServer.createIfAbsent("/apps/testNotificationTable/json", new
ConfigurableServerChannel.Initializer()
{
public void configureChannel(ConfigurableServerChannel channel)
{
channel.setPersistent(true);
}
}
ServerChannel channel =
bayeuxServer.getChannel("/apps/testNotificationTable/json");
Now you're guaranteed that the channel won't be swept.
Tracking this documentation void at http://bugs.cometd.org/browse/COMETD-337