0 Replies Latest reply on May 9, 2008 10:56 AM by mehdimk

    Problem with BlazeDS and dynamic destinations

      I'm trying to, instead of using messaging-config.xml, create the destination through the Java code, so that the users can dynamically subscribe to the newly created destinations.
      Here is my Java code:

      public void createDest() {
      MessageBroker msgBroker = MessageBroker.getMessageBroker(null);
      MessageService service = (MessageService) msgBroker.getService("message-service");
      MessageDestination d = (MessageDestination)service.createDestination("test");
      NetworkSettings ns = new NetworkSettings();

      The following method is called in actionscript once the creationComplete is triggered:

      private function run() {
      var consumer:Consumer = new Consumer();
      consumer.destination = "test";
      consumer.addEventListener(MessageEvent.MESSAGE, messageHandler2);

      The first line calls the method which creates the destination. It is really created and started (its isValid() and isStarted() methods return true)

      However when I run the code I encounter the following error (which points to the "consumer.subscribe();" line):

      [MessagingError message='Destination 'test' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']

      None of the items the error message is complaining about are true. Destination 'test' does exist, it has a channel (shown in the Java code) and also in the messaging-config.xml a default channel is defined:

      <channel ref="my-polling-amf"/>

      It also should be mentioned if I change the "test" to any destination that is explicitly defined in the messaging-config.xml it would work. (Instead of actionscript I also tried doing the same thing in mxml to no avail).

      I would appreciate any help to resolve this issue.