Using Messaging on other host

Discussions relating to Flex real-time messaging

Using Messaging on other host

Postby Björn Karpenstein » Fri Jun 25, 2010 8:19 am

Hi!

I am using Flex 3 and FluorineFX with <mx:RemoteObject>. Everything works fine, congratulations to that great middleware!

I have copied services-config.xml and remoting-config.xml to the src-Path and set the following compiler settings:

-locale en_US -services services-config.xml -context-root /

In this way i can set the absolute path to the fluorinefx server and develop locally without installing iis.

No my question:
Can i use messaging in this way (i mean with local services-config.xml and remoting-config.xml).

What must i do to compile the flex-app locally and use messaging of the remote server?

With best regards,
Björn Karpenstein

Content:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service" class="flex.messaging.services.RemotingService" messageTypes="flex.messaging.messages.RemotingMessage">

   <!-- DO NOT CHANGE <adapters> SECTION-->
    <adapters>
        <adapter-definition id="dotnet" class="FluorineFx.Remoting.RemotingAdapter" default="true"/>
    </adapters>

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

  <destination id="GenericDestination">
    <properties>
      <source>*</source>
    </properties>

    <!-- The following example shows a security constraint that is referenced -->
    <!--
    <security>
         <security-constraint ref="privileged-users"/>
      </security>
    -->

    <!-- The following example shows shows a security constraint that is declared in a destination definition (inline) -->
    <!--
      <security>
         <security-constraint>
            <auth-method>Custom</auth-method>
            <roles>
               <role>admin</role>
               <role>privilegeduser</role>
            </roles>
         </security-constraint>
      </security>               
        -->

  </destination> 

    <destination id="fluorine">
        <properties>
            <source>*</source>
        </properties>
       
        <!-- The following example shows a security constraint that is referenced -->
        <!--
        <security>
         <security-constraint ref="privileged-users"/>
      </security>
        -->
       
        <!-- The following example shows shows a security constraint that is declared in a destination definition (inline) -->
        <!--
      <security>
         <security-constraint>
            <auth-method>Custom</auth-method>
            <roles>
               <role>admin</role>
               <role>privilegeduser</role>
            </roles>
         </security-constraint>
      </security>               
        -->
       
    </destination>

   <!-- Configure a destination
      source: Fully qualified class name of the .NET object (remote object)
      scope: Indicates whether the object is available in the request scope, the application scope, or the session scope -->
   <!--
    <destination id="destination name">
        <properties>
            <source>Fully qualified class name of the .NET object</source>
            <scope>request</scope>
        </properties>
    </destination>
    -->
</service>


And

Code: Select all
<?xml version="1.0" encoding="utf-8" ?>
<services-config>
    <services>
      <service-include file-path="remoting-config.xml" />
        <!-- <service-include file-path="messaging-config.xml" /> -->
        <!-- <service-include file-path="data-management-config.xml" /> -->
    </services>
   
    <!-- Custom authentication -->
    <security>
      <!-- A security constraint requires that a user is authorized before accessing a destination.
      Here you can declare security constraints globally. When several destinations
      use the same security settings, you should define one security constraint in the
      security section of the services configuration file and refer to it in each destination.             
      -->
      <!--
      <security-constraint id="privileged-users">
         <auth-method>Custom</auth-method>
         <roles>
            <role>admin</role>
            <role>privilegeduser</role>
         </roles>
      </security-constraint>   
       -->

      <!--   
      Custom login command, to check a user's credentials and log a principal into the application server
      A login command must implement the com.TheSilentGroup.Fluorine.Messaging.Security.ILoginCommand interface
      or inherit from com.TheSilentGroup.Fluorine.Messaging.Security.GenericLoginCommand.
      
      You can use a login command without security constraints defined.
      -->
      <!--
      <login-command class="FluorineFx.Security.GenericLoginCommand" server="asp.net"/>
       -->
    </security>
   
    <channels>
        <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
         <endpoint uri="http://bbmag3j.bbmag.bbraun.com:4321/Gateway.aspx" class="flex.messaging.endpoints.AMFEndpoint"/>       
            <!-- <endpoint uri="http://{server.name}:{server.port}/{context.root}/Gateway.aspx" class="flex.messaging.endpoints.AMFEndpoint"/> -->
            <properties>
            <!-- <legacy-collection>true</legacy-collection> -->
            </properties>
        </channel-definition>
        <!--
        <channel-definition id="my-rtmp" class="mx.messaging.channels.RTMPChannel">
            <endpoint uri="rtmp://{server.name}:2037" class="flex.messaging.endpoints.RTMPEndpoint"/>
            <properties>
                <idle-timeout-minutes>20</idle-timeout-minutes>
            </properties>
        </channel-definition>
        -->
    </channels>
</services-config>
Björn Karpenstein
 
Posts: 3
Joined: Thu Jun 24, 2010 2:41 pm

Re: Using Messaging on other host

Postby sansegot » Sat Jul 10, 2010 10:16 am

I have exactly the same situation - in order to test application developed locally I needed to connect to the remote RTMP server where the messages were produced.

The solution is very similar to what you did with the AMF remoting - you just need to change the endpoint.
Here's a part of the local services-config.xml file which I'm using:
Code: Select all
<channel-definition id="my-rtmp" class="mx.messaging.channels.RTMPChannel">
  <endpoint uri="rtmp://www.example-server.com:2037" class="flex.messaging.endpoints.RTMPEndpoint"/>
    <properties>
      <idle-timeout-minutes>20</idle-timeout-minutes>
    </properties>
</channel-definition>


And that's basically it.

Whenever I'm making a release build of the application I change this back to {server.name} ... although it will probably work even if I didn't do it.
sansegot
 
Posts: 17
Joined: Wed Jul 07, 2010 9:13 am

Re: Using Messaging on other host

Postby Björn Karpenstein » Fri Jul 23, 2010 8:34 am

Thank you very much for your reply!

Do i have to install an RTMP-Server or s.th. like that on the host system? I can not get access to the Port 2037 using telnet.

Currently there just is the FluorineFX WebApp deployt on it. Have i to configure sth. for that port?
Björn Karpenstein
 
Posts: 3
Joined: Thu Jun 24, 2010 2:41 pm

Re: Using Messaging on other host

Postby sansegot » Fri Jul 23, 2010 4:04 pm

You need to install the FluorineFX only on the server you will be connecting.
If you have FluorineFX webapp already deployed on it, just configure it accept RTMP connections.

You will need two service-config.xml files:
1) the first one on the RTMP server (it configures the RTMP server)
2) the second one on the PC you are using to build your project (it tells the Flex compiler where the RTMP server is)

The first one will contain relative paths such as tmp://{server.name}:2037,
while in the second one use concrete paths to the RTMP server - i.e.: rtmp://bbmag3j.bbmag.bbraun.com:2037/

If you plan to deploy the Flex application on the same server on which the RTMP server resides,
make sure to compile the release version using the first configuration files - just in case.

That should be it - it's really simple!
sansegot
 
Posts: 17
Joined: Wed Jul 07, 2010 9:13 am

Re: Using Messaging on other host

Postby Björn Karpenstein » Fri Aug 06, 2010 10:44 am

Thank you very much! Now it works fine!

Sometimes i get (maybe of socket error??) the message:

Client.Error.Subscribe The consumer was not able to subscribe to its target destination. Consumer subscribe error karpbjde

Before i did the mistake to show an ALERT Window, now i am doin nothing on this.

Is this critical? I subscript onCreationComplete in Flex
Björn Karpenstein
 
Posts: 3
Joined: Thu Jun 24, 2010 2:41 pm

Re: Using Messaging on other host

Postby sansegot » Fri Aug 13, 2010 10:07 am

Could you post the complete details of this error? It's difficult to say what may be the cause of the problem...
sansegot
 
Posts: 17
Joined: Wed Jul 07, 2010 9:13 am


Return to FluorineFx Messaging

Who is online

Users browsing this forum: No registered users and 1 guest