4 Replies Latest reply on Mar 21, 2008 9:44 AM by koolawe

    Need help configuring BlazeDS dashboard demo

    koolawe
      Hi, just getting started with BlazeDS, trying to rebuild the collaborative 'dashboard' demo which is provided with an Ant build.xml which I've had trouble getting to run correctly with mxmlc. Instead I've imported this into Eclipse and added:
      -services d:/dev/tomcat/webapps/dash/dashboard-debug/WEB-INF/flex/services-config.xml
      to the FlexBuilder compiler options line. This allows the app to run. It comes up and displays the components, however events (such as clicking on a pie slice or changing the month) which are sent to the producer are never received by the consumers.

      private function initApp():void {
      consumer.subscribe(); // ....
      }

      // Send messages when user's selection changes
      // (event handler of slider)
      private function monthChange():void {
      var message:IMessage = new AsyncMessage();
      message.body = {month: timeline.selectedMonth};
      producer.send(message);
      }

      <mx:Producer id="producer" destination="dashboard"/>
      <mx:Consumer id="consumer" destination="dashboard" message="messageHandler(event)"/>

      So, with this snippet, produer.send() is being called but the consumer's messageHandler(event) is not. Am I missing running a backend service or endpoint configuration to get the messages to flow thru the server? The code is so simple, but the configuration is a brick wall. Any help would be appreciated!
      Thanks,
      Michael
        • 1. Re: Need help configuring BlazeDS dashboard demo
          riesvantwisk Level 1
          Hey,

          For this reason my own build file (I had a hard time myself to get it going).

          so if you want a nice buildfile checkout this link : http://www.vantwisk.nl/riesvantwisk/entry/adobe_flex_and_blaze_ds

          I am soon going to update it with a even better build file and a method to compile modules within your application aswell.

          The zip has been designed to 'just run' and contains all goodies so it should work.

          Ries
          • 2. Re: Need help configuring BlazeDS dashboard demo
            koolawe Level 1
            Ries, thanks for the buildfile but I was already able to get it to build with Flexbuilder (Eclipse plugin.) The problem is that the messages sent to the producer are not being delivered to the consumers. Do I need to run an 'echo' servlet or does the Flex MessageBroker do this distribution automatically? Since I'm just getting into the messaging architecture, I am assuming this is a configuration issue. Perhaps there is a missing .jar file? Could someone please explain what components from the BlazeDS kit are needed to rebuild the 'collaborative dashboard' demo?
            M.
            • 3. Re: Need help configuring BlazeDS dashboard demo
              riesvantwisk Level 1
              Hey,

              I am not sure about the dashboard since it was some weeks ago since I have seen it. But from the looks of it (uses consumer/producer) you need to have an proper setup on the server. By just uploading the swf will not make your dashboard work.

              If I am not mistaken your destination for the dashboard needs to be configured in messaging-config.xml and that file should look like this:

              <?xml version="1.0" encoding="UTF-8"?>
              <service id="message-service" class="flex.messaging.services.MessageService">
              <adapters>
              <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="true" />
              </adapters>

              <default-channels>
              <channel ref="my-polling-amf"/>
              <channel ref="my-streaming-amf"/>
              </default-channels>

              <destination id="dashboard">
              </destination>

              </service>



              The above messaging-config.xml get's included in services-config.xml using the following line:
              <service-include file-path="messaging-config.xml" />

              Also make sure you have a proper web.xml that contains the MessageBrokerServlet (samples can be found in blaze-ds samples file).

              Needs to contain something like this:

              <!-- Http Flex Session attribute and binding listener support -->
              <listener>
              <listener-class>flex.messaging.HttpFlexSession</listener-class>
              </listener>

              <!-- MessageBroker Servlet -->
              <servlet>
              <servlet-name>MessageBrokerServlet</servlet-name>
              <display-name>MessageBrokerServlet</display-name>
              <servlet-class>
              flex.messaging.MessageBrokerServlet
              </servlet-class>
              <init-param>
              <param-name>services.configuration.file</param-name>
              <param-value>/WEB-INF/flex/services-config.xml</param-value>
              </init-param>
              <load-on-startup>1</load-on-startup>
              </servlet>

              <servlet-mapping>
              <servlet-name>MessageBrokerServlet</servlet-name>
              <url-pattern>/messagebroker/*</url-pattern>
              </servlet-mapping>

              You lib directory needs to contain the blaze-ds jar files, or you can deploy the given blaze-ds.war as given somewhere in the download (top of my head).

              Last but not least you need to run it on tomcat, glasshfish or whatever application server.

              Ries
              • 4. Re: Need help configuring BlazeDS dashboard demo
                koolawe Level 1
                Ries, that is pretty much what I have-- I duplicated the samples config files and pared them down some for just the dashboard messaging service, the channel defs, etc. and the HttpFlexSession listener and MessageBrokerServlet in web.xml. This is on Catalina. Is there a way to verbosely log / debug the startup of the MessageBrokerServlet or see what instances of it are running on the server? Is one instance shared across all deployed webapps?
                Thanks!
                M.