Expand my Community achievements bar.

How do I get LCCS notifications using Java/Spring?

Avatar

Level 2

I'm am not receiving callbacks with hooks I've setup within my Java application from the LiveCycle rooms when nodes are created or updated.

What is the service id I should be using for this and why might this setup not be working?

My setup

  • Windows Server 2008 R2
  • Jetty Application Server
  • BlazeDS
  • Spring

services-config.xml

<?xml version="1.0" encoding="UTF-8"?>

<services-config>

    <services>

        <default-channels>

           <channel ref="amf"/>

        </default-channels>

    </services>

    <channels>

  <channel-definition id="amf" class="mx.messaging.channels.AMFChannel">

                        <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"

                            class="flex.messaging.endpoints.AMFEndpoint"/>

                        <properties>

                            <polling-enabled>false</polling-enabled>

                        </properties>

                        <serialization>

                        <legacy-map>false</legacy-map>

                        </serialization>

  </channel-definition>

    </channels>

</services-config>

remoting-config.xml

<?xml version="1.0" encoding="UTF-8"?>

<service id="remoting-service"

    class="flex.messaging.services.RemotingService">

    <adapters>

        <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>

    </adapters>

    <default-channels>

        <channel ref="amf"/>

    </default-channels>

    <destination id="LCCS" channels="amf">

        <properties>

            <source>com.adobe.rtc.account.AccountManager</source>

        </properties>

    </destination>

    <destination id="MySessionHandler" channels="amf">

        <properties>

            <source>com.adobe.rtc.MySessionHandler</source>

        </properties>

        <adapter ref="java-object"/>

    </destination>

  </service>

RTCHOOKS.java

@RemotingDestination(channels={"amf"})

@Service("RTC")

public class RTCHOOKS {

          public void receiveNode(String token, String roomName, String collectionName, String nodeName, Map config) {

                    ActivityLog.logActivity(ACTIVITY.ACTIVITY_RTC_HOOK, "ReceiveNode: " + token + " " + roomName + " " + collectionName + " " + nodeName);

                    System.out.println("ReceiveNode: " + token + " " + roomName + " " + collectionName + " " + nodeName);

          }

  ...

}

LCCSRoom.java

  /**

           * Register LCCS hooks

           * @throws Exception

           */

          protected void register() throws Exception

          {

                    AccountManager lccsAM = getAccountManager();

                    lccsAM.registerHook(getEndpoint(), getToken());

  }

  /**

           * Subscribe to a collection

           * @param room

           * @param collection

           * @throws Exception

           */

          public void subscribe(String room, LCCS_COLLECTIONS collection) throws Exception

          {

                    AccountManager lccsAM = getAccountManager();

                    lccsAM.subscribeCollection(room, collection.toString());

          }

  /**

           * Get or create room session for a room

           * @param room

           * @return

           * @throws Exception

           */

          public Session getRoomSession(String room, Map<String, Object>conferenceMap, Map<String, Object>roomMap) throws Exception

          {

...

                                subscribe(room, "testCollection");

...

      }

Thanks!

7 Replies

Avatar

Employee

Is your application server publicly accessible ? Otherwise our servers will not be able to contact it.

Also the README in serverIntegrations/java says :

  7) update remote-config.xml with following: (id="RTCHOOKS" is required)

   <destination id="RTCHOOKS">

        <properties>

            <source>flex.samples.LCCS.RTCHOOKS</source>

        </properties>

    </destination>

It looks like you have the other two (that are not really required for LCCS) but not RTCHOOKS. I am not familiar with the Spring configuration for BlazeDS but I don't see RTCHOOKS specified there neither. Did you try, for example, @Service("RTCHOOKS").

Again, I am not familiar with Spring and BlazeDS integration but the main point is that the exposed service needs to be named RTCHOOKS. Our servers will send RPC in the form of RTCHOOKS.methodName so the AMF endpoints needs to be configured to dispatch requests for RTCHOOKS.

Avatar

Level 2

Publically accessible - yes to port 80.  Are any other ports required for RTCHOOKS?

RE: Readme - That's what I had originally, but since it wasn't working I decided to do things the spring way.  I'll give that another try.

Had @Service("RTCHOOKS")

Tried @Service("RTC")

Now Removed Aspect @Service("RTC")

Added in remote-config.xml

<destination id="RTCHOOKS">

        <properties>

            <source>flex.samples.LCCS.RTCHOOKS</source>

        </properties>

    </destination>

Tested this setup and still no messages when adding/retracting items are logged.

Avatar

Employee

Did you keep your package structure as in the example ? (the package for RTCHOOKS.java should be  flex.samples.LCCS). Otherwise you'll need to update the source property accordingly.

Also, did you try the provided example in sampleApps/Server2Server/BlazeDSGateway_Java AS IS ? And, did you try running it agains the local server ?

You should be able to run the "Local Connection Server" available with the LCCS SDK App and test your service running on a local machine against it. When it works you can host your service on a publicly available host and test against our services.

One more thing: I am assuming you did went through the procedure of registering your service with us. If you send us your account URL we can check that your are correctly registered.

Avatar

Level 2

Yes, I updated the source property accordingly to match our package structure.  Just trying to keep things generic in the forums.

I'll give that a try.

Sent you a PM.

Avatar

Employee

You hook URL is registered correctly but I looked at our server logs for most of last week but I couldn't find any reference to your account so I can't really do much more than this.

Let us know if you get the sample app working against the local connection server.

Avatar

Level 2

Thanks for your help Raff.  We got it working after making a firewall change and correcting an issue with the hook URL, which should have gone to a subdirectory.

For anyone else using Spring 3, the aspect oriented setup works fine.

@RemotingDestination(channels={"amf"})

@Service("RTC")

public class RTCHOOKS {

}

Just make sure the class is contained in a package specified in

<context:component-scan base-package="..." />

Avatar

Employee

Great! And thanks for the tip for Spring annotations. We'll add it to the documentation.