title: Railo to talk to XMPP/Jabber/Google Talk from within Railo?
body: <p>I have implemented ColdFusion XMPP Event Gateway in coldfusion server 10 and it is working fine with google talk. The same thing i want to implement in Railo server but no luck to find something.</p>
  
  <p>Please suggest something to "Railo to talk to XMPP/Jabber/Google Talk from within Railo"</p>
  
  <p><strong>Used cfc file in coldfusion XMPP event gateway</strong></p>
  
  <pre><code>&lt;cfcomponent displayname="EventGateway" hint="Process events from the test gateway and return echo"&gt;
      &lt;cffunction name="onIncomingMessage" output="no"&gt;
          &lt;cfargument name="CFEvent" type="struct" required="yes"&gt;
  
          &lt;cflog file="#CFEvent.GatewayID#Status" text=" onIncomingMessage; SENDER: #CFEvent.Data.SENDER# MESSAGE:
  #CFEvent.Data.MESSAGE# TIMESTAMP: #CFEvent.Data.TIMESTAMP# "&gt;
  
          &lt;!--- Get the message ---&gt;
          &lt;cfset data=cfevent.DATA&gt;
          &lt;cfset message="#data.message#"&gt;
          &lt;!--- where did it come from? ---&gt;
          &lt;cfset orig="#CFEvent.originatorID#"&gt;
          &lt;cfset retValue = structNew()&gt;
          &lt;cfif listcontains("XMPP ", arguments.CFEVENT.GatewayType) gt 0&gt;
              &lt;cfset retValue.BuddyID = orig&gt;
              &lt;cfset retValue.MESSAGE = "echo: " &amp; message&gt;
          &lt;cfelseif arguments.CFEVENT.GatewayType is "Socket"&gt;
              &lt;cfset retValue.originatorID = orig&gt;
              &lt;cfset retValue.message = "echo: " &amp; message&gt;
          &lt;cfelseif arguments.cfevent.gatewaytype is "SMS"&gt;
              &lt;cfset retValue.command = "submit"&gt;
              &lt;cfset retValue.sourceAddress = arguments.CFEVENT.GatewayID&gt;
              &lt;cfset retValue.destAddress = orig&gt;
              &lt;cfset retValue.shortMessage = "echo: " &amp; message&gt;
          &lt;/cfif&gt;
  
          &lt;!--- we can write our script to process like database Query here ---&gt;
  
          &lt;!--- send the return message back ---&gt;
          &lt;cfreturn retValue&gt;
      &lt;/cffunction&gt;
  
      &lt;cffunction name="onAddBuddyRequest"&gt;
          &lt;cfargument name="CFEvent" type="struct" required="YES"&gt;
  
          &lt;cflock scope="APPLICATION" timeout="10" type="EXCLUSIVE"&gt;
              &lt;cfscript&gt;
              // If the name is in the DB once, accept; if it is missing, decline.
              // If it is in the DB multiple times, take no action.
              action="accept";
              reason="Valid ID";
              //Add the buddy to the buddy status structure only if accepted.
              if (NOT StructKeyExists(Application,"buddyStatus")) {
                  Application.buddyStatus=StructNew();
              }
              if (NOT StructKeyExists(Application.buddyStatus,CFEvent.Data.SENDER)) {
                  Application.buddyStatus[#CFEvent.Data.SENDER#]=StructNew();
              }
              Application.buddyStatus[#CFEvent.Data.SENDER#].status="Accepted Buddy Request";
              Application.buddyStatus[#CFEvent.Data.SENDER#].timeStamp=
              CFEvent.Data.TIMESTAMP;
              Application.buddyStatus[#CFEvent.Data.SENDER#].message=CFEvent.Data.MESSAGE;
              &lt;/cfscript&gt;
          &lt;/cflock&gt;
  
          &lt;!--- Log the request and decision information. ---&gt;
          &lt;cflog file="#CFEvent.GatewayID#Status" text="onAddBuddyRequest; SENDER: #CFEvent.Data.SENDER# MESSAGE:
  #CFEvent.Data.MESSAGE# TIMESTAMP: #CFEvent.Data.TIMESTAMP# ACTION: #action#"&gt;
  
          &lt;!--- Return the action decision. ---&gt;
          &lt;cfset retValue = structNew()&gt;
          &lt;cfset retValue.command = action&gt;
          &lt;cfset retValue.BuddyID = CFEvent.DATA.SENDER&gt;
          &lt;cfset retValue.Reason = reason&gt;
  
          &lt;cfreturn retValue&gt; 
      &lt;/cffunction&gt;
  
      &lt;cffunction name="onAddBuddyResponse"&gt;
      &lt;/cffunction&gt;
  
      &lt;cffunction name="onBuddyStatus"&gt;
      &lt;/cffunction&gt;
  
      &lt;cffunction name="onIMServerMessage"&gt;
      &lt;/cffunction&gt;
  &lt;/cfcomponent&gt;
  </code></pre>
  
  <p>Thanks,<br>
  Arun</p>