Problem with programmatically building a Gravity Channel

183 views
Skip to first unread message

Murray Furtado

unread,
Mar 6, 2013, 6:18:05 AM3/6/13
to gran...@googlegroups.com
Hi

according to Chapter 3 of the Granite reference doc - 'When using a services-config.xml file, it's necessary to use the compiler option -services path/to/services-config.xml so the Flex SDK itself can handle the creation of the channel and other remoting objects. If you don't use this option, you will have to specify manually a channel and endpoint for each destination in ActionScript 3 :

private function init():void {
        srv = new RemoteObject("myService");
        srv.source = "myService";
        srv.channelSet = new ChannelSet();
        srv.channelSet.addChannel(new AMFChannel("graniteamf",
            "http://{server.name}:{server.port}/myapp/graniteamf/amf"));
        srv.showBusyCursor = true;
}'


I am trying to do this for a Gravity Channel as below, but cannot seem to get it to work .

private function init():void {
        srv = new RemoteObject("myService");
        srv.source = "myService";
        srv.destination="GravityService";
        srv.channelSet = new ChannelSet();
        srv.channelSet.addChannel(new GravityChannel("gravityamf",
            "http://{server.name}:{server.port}/myapp/gravityamf/amf"));

I am then trying to create a Consumer as follows:

        var consumer : Consumer = new Consumer();
        consumer.destination = "GravityService";
        consumer.subscribe();

But when I do so I get the following error:

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

When I add in the additional compiler option -services path/to/services-config.xml, my Consumer subscribes without problem and Gravity works fine.

I am able to create AMF services programmatically without problem using almost identical code (by adding an AMFChannel rather than a GravityChannel). Can someone please tell me what I'm doing wrong.

Thanks in advance!

Here are the relevant bits from my services-config.xml file :

        <channel-definition
                id="gravityamf"
                class="org.granite.gravity.channels.GravityChannel">
            <endpoint
                    uri="http://myServer:8080/myapp/gravityamf/amf"
                    class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>

       <services>
        <service id="messaging-service"
                 class="flex.messaging.services.MessagingService"
                 messageTypes="flex.messaging.messages.AsyncMessage">
            <adapters>
                <adapter-definition id="jms"
                                    class="org.granite.gravity.adapters.JMSServiceAdapter" default="true"/>

            </adapters>

            <destination id="GravityService">
                <channels>
                    <channel ref="gravityamf"/>
                </channels>
                <properties>
                    <jms>
                        <destination-type>Topic</destination-type>
                        <message-type>javax.jms.TextMessage</message-type>
                        <connection-factory>ConnectionFactory</connection-factory>
                        <destination-jndi-name>topic/GravityTopic</destination-jndi-name>
                        <destination-name>GravityTopic</destination-name>
                        <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
                        <transacted-sessions>false</transacted-sessions>
                    </jms>
                </properties>
                <adapter ref="jms" />
            </destination>
        </service>
    </services>








Message has been deleted

Murray Furtado

unread,
Mar 19, 2013, 5:58:10 AM3/19/13
to gran...@googlegroups.com
Ok, so made some progress on this, thanks to an email from Franck Wolff. He suggested the following:

private function init():void {
        
var consumer : Consumer = new Consumer();
        consumer.destination = "GravityService";
        
consumer.channelSet = new ChannelSet();
         consumer.channelSet.addChannel(new GravityChannel("gravityamf",
            "http://{server.name}:{server.port}/myapp/gravityamf/amf"));
        consumer.subscribe();
}

So I made this change,
but this doesn't seem to fully work. Here is the trace I get:
 
[trace] 13:30:07.323 [INFO] org.granite.gravity.Consumer '180454AF-EE56-AE70-7964-7DB1585B4712' org.granite.gravity.Consumer set destination to 'GravityService'.
[trace] 13:30:07.323 [INFO] mx.messaging.Channel 'gravityamf' channel endpoint set to http://LG007849:8080/indigo-server-war/gravityamf/amf
[trace] 13:30:07.760 [INFO] mx.messaging.Channel 'gravityamf' channel is connected.
[trace] 13:30:07.776 [DEBUG] mx.messaging.Channel 'gravityamf' channel sending message:
[trace] (mx.messaging.messages::CommandMessage)
[trace]   body=(Object)#0
[trace]   clientId=(null)
[trace]   correlationId=""
[trace]   destination="GravityService"
[trace]   headers=(Object)#0
[trace]   messageId="1C29A777-D1AA-1DCC-1405-7DB15A105C13"
[trace]   operation="subscribe"
[trace]   timeToLive=0
[trace]   timestamp=1363613407323
[trace] 13:30:07.776 [INFO] org.granite.gravity.Consumer '180454AF-EE56-AE70-7964-7DB1585B4712' org.granite.gravity.Consumer connected.
[trace] 13:30:07.838 [ERROR] org.granite.gravity.Consumer '180454AF-EE56-AE70-7964-7DB1585B4712' org.granite.gravity.Consumer fault for '1C29A777-D1AA-1DCC-1405-7DB15A105C13'.

 
Compare this to the trace when I add in the -services path/to/services-config.xml compile option, where the bold trace statements are also printed:
 
 
[trace] 13:25:58.219 [INFO] org.granite.gravity.Consumer 'D6410CB2-42AB-B073-4BBD-7DAD8B4BA58B' org.granite.gravity.Consumer set destination to 'GravityService'.
[trace] 13:26:01.234 [INFO] mx.messaging.Channel 'gravityamf' channel endpoint set to http://LG007849:8080/indigo-server-war/gravityamf/amf
[trace] 13:26:01.234 [INFO] mx.messaging.Channel 'gravityamf' channel settings are:
[trace] <channel id="gravityamf" type="org.granite.gravity.channels.GravityChannel">
[trace]   <endpoint uri="
http://LG007849:8080/indigo-server-war/gravityamf/amf"/>
[trace]   <properties/>
[trace] </channel>
[trace] 13:26:01.297 [INFO] mx.messaging.Channel 'gravityamf' channel is connected.
[trace] 13:26:01.297 [DEBUG] mx.messaging.Channel 'gravityamf' channel sending message:
[trace] (mx.messaging.messages::CommandMessage)
[trace]   body=(Object)#0
[trace]   clientId=(null)
[trace]   correlationId=""
[trace]   destination="GravityService"
[trace]   headers=(Object)#0
[trace]   messageId="E2D73259-C1D3-CAFB-C433-7DAD9751B56D"
[trace]   operation="subscribe"
[trace]   timeToLive=0
[trace]   timestamp=1363613158219
[trace] 13:26:01.313 [INFO] org.granite.gravity.Consumer 'D6410CB2-42AB-B073-4BBD-7DAD8B4BA58B' org.granite.gravity.Consumer connected.
 
It would seem the xml isn't gernerated when configuring programmatically. There must be another step which needs taking to do this. Anyone have any ideas?

alex fernandez

unread,
Jan 12, 2017, 5:06:37 AM1/12/17
to gran...@googlegroups.com
Hi, I know it's been so much time, but did you manage to do it? Any luck with it??

--
 
---
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes Granite Data Services Forum.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse graniteds+unsubscribe@googlegroups.com.
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .
 
 

Mike Rudko

unread,
Mar 24, 2024, 10:21:58 AMMar 24
to gran...@googlegroups.com
Alex;
Call me. 

Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse graniteds+...@googlegroups.com.

Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .
 
 

--

---
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "Granite Data Services Forum".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse graniteds+...@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages