Expand my Community achievements bar.

null MessageBroker

Avatar

Former Community Member

My application needs server push.  I am trying to get a simple "Hello World" going, but I can't get past a null MessageBroker.  I simplified my configuration files and it might be my issue.

My services-config.xml

includes only the messaging and data-management configs:

<service-include file-path="messaging-config.xml"/>
<service-include file-path="data-management-config.xml"/>

channels:

<default-channels>
   <channel ref="my_rtmp"/>
   <channel ref="my_amf"/>
   <channel ref="my_polling-amf"/>
</default-channels>

a single server

<server id="my-nio-server" class="flex.messaging.socketserver.SocketServer">

and i left the channel definitions as defined.

My messaging-config.xml is:

<service id="message-service" class="flex.messaging.services.MessageService">
  <adapters>
    <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="false"/>
  </adapters>
  <destination id="DocumentSessionTopic">
    <properties>
       <network>
          <subscription-timeout-minutes>0</subscription-timeout-minutes>
       </network>
       <server>
          <max-cache-size>1000</max-cache-size>
          <message-time-to-live>0</message-time-to-live>
          <allow-subtopics>true</allow-subtopics>
          <subtopic-separator>.</subtopic-separator>
          <cluster-message-routing>server-to-server</cluster-message-routing>
      </server>
    </properties>
    <channels>
       <channel ref="my_amf"/>
       <channel ref="my_polling-amf"/>
    </channels>
  </destination>
</service>

My java part is:

MessageBroker msgBroker;
msgBroker = MessageBroker.getMessageBroker(null);
msgBroker.start();

msgBroker is null when I try to invoke its start() method.

Thanks in advance.

1 Reply

Avatar

Employee

What context is your Java code being executed in?

You need to be in the same web application as LCDS, so the MessageBrokerServlet will have created and registered the MessageBroker in the static table.  I assume also that you have not defined an identifier in the web.xml for the MessageBroker so the null argument to the get function should find the default instance (named "__default_").

You can take a look at the MessageBroker code in svn here: http://opensource.adobe.com/svn/opensource/blazeds/trunk/modules/core/src/flex/messaging/