Skip to content

Instantly share code, notes, and snippets.

@imageaid
Created December 14, 2010 15:55
Show Gist options
  • Save imageaid/740610 to your computer and use it in GitHub Desktop.
Save imageaid/740610 to your computer and use it in GitHub Desktop.
The CFML Application.cfc file ... basic!
<cfcomponent output="false">
<cfset this.name = "JMSTest">
<cfset this.applicationTimeout = createTimeSpan(0,2,0,0)>
<cfset this.clientManagement = false>
<cfset this.sessionManagement = false>
<cfset this.setClientCookies = true>
<cfset this.setDomainCookies = false>
<!--- Run when application starts up --->
<cffunction name="onApplicationStart" returnType="boolean" output="false">
<!--- HACK ALERT --->
<cfscript>
// For some reason, I need to setup the initial topics from Railo/CFML server before the first Flex client subscribes.
// So, I publish two blank messages to the topics on app startup.
// Short-run/hack, I created an initMessages method on the messageService object to initialize the messages
// There MUST be a better way!
var messageService = createObject("java","com.kronum.gateways.adapters.KronumJMSPublisher");
messageService.initMessages("kronumAnnouncements");
messageService.initMessages("kronumMessages");
</cfscript>
<cfreturn true>
</cffunction>
<!--- Run when application stops --->
<cffunction name="onApplicationEnd" returnType="void" output="false">
<cfargument name="applicationScope" required="true">
</cffunction>
<!--- Run before the request is processed --->
<cffunction name="onRequestStart" returnType="boolean" output="false">
<cfargument name="thePage" type="string" required="true">
<cfreturn true>
</cffunction>
<!--- Runs at end of request --->
<cffunction name="onRequestEnd" returnType="void" output="false">
<cfargument name="thePage" type="string" required="true">
</cffunction>
</cfcomponent>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment