0 Replies Latest reply on Nov 22, 2010 8:29 AM by mark.engel

    Trying to call specific service plugin

    mark.engel

      Hello,

       

      I'm trying to build a service plugin system.

      On the server side I have different implementations of an interface all labeled with the same @Service annotation.

       

      @Service(Services.Plugin)
      public class Plugin[1..n] {
        @Command(Command.Get)
        public void get(Message m) {
          MessageBuilder
            .createConversation(message)
            .toSubject(Receiver.Plugin)
            .with(Parts.Value, value)
            .defaultErrorHandling()
            .reply();
        }
        @Command(Command.Set)
        public void set(Message m) {
          ...
        }

      @Service(Services.Plugin)

      public class Plugin[1..n] {

        @Command(Command.Get)

        public void get(Message m) {

          MessageBuilder

            .createConversation(message)

            .toSubject(Receiver.Plugin)

            .with(Parts.Value, value)

            .defaultErrorHandling()

            .reply();

        }

       

        @Command(Command.Set)

        public void set(Message m) {

          ...

        }

       

      On the client side I can call all getter methods with

       

       

      MessageBuilder   .createMessage()   .toSubject(Service.Plugin)   .command(Command.Get)   .noErrorHandling()   .sendNowWith(bus);

       

      and I receive my updates on the subscription to Receiver.Plugin

       

      Now I have the problem that I get Null Pointer Exceptions when I try to call the set method of one plugin.

      I thought that I could call the set method of a specific plugin if I respond to the message I received from Plugin.get()

      I tried to use the following function call from the client

       

       

              MessageBuilder

                      .createConversation(messageReceivedFromServer)

                      .toSubject(Service.Plugin) // .subjectProvided() did also not work

                      .command(Command.Set)

                      .with(Parts.Value, newValue)

                      .defaultErrorHandling()

                      .reply();

       

       

      Is it only possible to use createConversation on the server side?

      Is it possible to call one service of several if they have the same name?

      Or am I doing some mistake here?

       

      Here is the exception I receive when I try to send the latter method.

      https://gist.github.com/d9f7855e0f3d70af2fe7