On Sat, Feb 4, 2012 at 17:59, Luca Merolla <luca.m...@gmail.com> wrote:
> Hello everyone,
>
> I'm playing with CometD annotation style of the Services and I have a
> couple of question about it:
>
> 1) How can I have multiple *Service.java classes in the server side to
> handle different channels?
> The problem here seems that I need to pass this
>
> <init-param>
> <param-name>services</param-name>
> <param-value>org.test.service.GameService</param-value>
> </init-param>
>
> to the AnnotationCometdServlet in the web.xml file, and i don't know
> how to pass multiple files.
See http://docs.cometd.org/reference/#java_server_configuration.
You can pass a comma-separated list of classes.
> 2) I want to create some Client-Side Annotated Services too.
Ok.
> Both for the Local and Remote Session.
Mmm, this does not sound right.
You cannot create client-side services for local sessions. Local
sessions live on the server, not on the client.
See http://docs.cometd.org/reference/#concepts
> What is the way to make these classes instantiated? On the Local
> (Server side) one I probably need to fix the problem #1, but about the
> Remote is it possible to use the Annotation in a Remote J2SE client?
See http://docs.cometd.org/reference/#java_server_services_annotated_client-side,
in particular section "Annotation Processing".
J2SE clients instantiate services and use a ClientAnnotationProcessor
to resolve dependencies and process CometD annotations.
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
Hi,
On Sat, Feb 4, 2012 at 17:59, Luca Merolla <luca.me...m> wrote:
> Hello everyone,
>
> I'm playing with CometD annotation style of the Services and I have a
> couple of question about it:
>
> 1) How can I have multiple *Service.java classes in the server side to
> handle different channels?
> The problem here seems that I need to pass this
>
> <init-param>
> <param-name>services</param-name>
> <param-value>org.test.service.GameService</param-value>
> </init-param>
>
> to the AnnotationCometdServlet in the web.xml file, and i don't know
> how to pass multiple files.See http://docs.cometd.org/reference/#java_server_configuration.
You can pass a comma-separated list of classes.
> 2) I want to create some Client-Side Annotated Services too.
Ok.
> Both for the Local and Remote Session.
Mmm, this does not sound right.
You cannot create client-side services for local sessions. Local
sessions live on the server, not on the client.
See http://docs.cometd.org/reference/#concepts
> What is the way to make these classes instantiated? On the Local
> (Server side) one I probably need to fix the problem #1, but about the
> Remote is it possible to use the Annotation in a Remote J2SE client?See http://docs.cometd.org/reference/#java_server_services_annotated_client-side,
in particular section "Annotation Processing".J2SE clients instantiate services and use a ClientAnnotationProcessor
to resolve dependencies and process CometD annotations.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 Thu, Mar 15, 2012 at 22:44, Luca Merolla <luca.m...@gmail.com> wrote:
> System.out.println("handshake...");
> client.handshake();
>
> service.subscribeLobby(null);
Subscriptions should be done from /meta/handshake listeners (but
that's not the problem here).
> client.getChannel(CHANNEL).publish(new String("oooo"));
>
> System.out.println("disconnect...");
> client.disconnect();
The problem here is that you publish and immediately after you
disconnect, so the BayeuxClient has no chance to actually send the
message.
Remeber that publish() is asynchronous, so the fact that you publish()
does not mean that when the method returns, the message is actually
published.
It is only queued for publishing, and will be published by a different
thread, so if you disconnect() meanwhile, there is a chance that the
message never hits the network.