Title:
Bug 73926:(Watson Migration Closure)Resolve failure situation presently in CF8 whereby an Instant Messaging Event Gateway requires manual restart if it fails at some point
| View in TrackerStatus/Resolution/Reason: Closed/Deferred/
Reporter/Name(from Bugbase): Sam Juvonen / Sam Juvonen (Sam Juvonen)
Created: 12/02/2008
Components: Event Gateway
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Normal / Unknown
Locale/System: English / Win All
Vote Count: 0
Problem:
Resolve failure situation presently in CF8 whereby an Instant Messaging Event Gateway requires manual restart if it fails at some point. Would be good to have a feature to auto-restart x times before staying failed. Workaround is to notice lack of presence and then use the Admin client to restart.
Method:
EXAMPLE EVENT GATEWAY:
<cfcomponent>
<cffunction name="onIncomingMessage">
<cfargument name="CFEvent" type="struct" required="yes">
<!--- Get the message --->
<cfset var message=CFEvent.data.message>
<cfset var originatorID=CFEvent.originatorID>
<!--- Result structure --->
<cfset var retValue=structNew()>
<cfset retValue.BuddyID= originatorID >
<cfif LCase(Left(Trim(#message#),4)) is "who:">
<cfset retValue.Message=who(#message#)>
<cfelseif message is "locations">
<cfset retValue.Message=locations()>
<cfelseif message is "divisions">
<cfset retValue.Message=divisions()>
<cfelseif message is "plymcafetoday">
<cfset retValue.Message=todaysPlymouthCafeteriaFeature()>
<cfelseif message is "menu">
<cfset retValue.Message=menu()>
<cfelseif message is "help">
<cfset retValue.Message=menu()>
<cfelseif message is "?">
<cfset retValue.Message=menu()>
<cfelseif message is "whoami">
<cfset retValue.Message="#CFEvent.originatorID#">
<cfelseif message is "senderid">
<cfset retValue.Message=getSenderId(#CFEvent#)>
<cfelseif message is "now">
<cfset retValue.Message=getTimeStamp(#CFEvent#)>
<cfelse>
<cfset retValue.Message="You said: #message#">
</cfif>
<!--- send the return message back --->
<cfreturn retValue>
</cffunction>
<cffunction name="onAddBuddyRequest">
<cfargument name="CFEvent" type="struct" required="YES">
</cffunction>
<cffunction name="onAddBuddyResponse">
<cfargument name="CFEvent" type="struct" required="YES">
</cffunction>
<cffunction name="onBuddyStatus">
<cfargument name="CFEvent" type="struct" required="YES">
</cffunction>
<cffunction name="onIMServerMessage">
<cfargument name="CFEvent" type="struct" required="YES">
</cffunction>
<cffunction name="onAdminMessage">
<cfargument name="CFEvent" type="struct" required="YES">
</cffunction>
<cffunction name="menu">
<cfreturn "Options:#chr(10)#who:<userid>#chr(10)#locations#chr(10)#divisions#chr(10)#plymcafetoday">
</cffunction>
<cffunction name="who">
<cfargument name="message">
<cftry>
<cfset userID=Trim(Right(Trim(#message#), Len(Trim(#message#))-4))/>
<cfldap
server = "plymdc.fngp.com"
port="389"
action = "query"
username="FNGP\app_userup"
password="T@!4qtrs"
name = "results"
start = "DC=fngp,DC=com"
filter = "(&(objectclass=user)(|(samAccountname=#userID#*)(cn=#userID#*)(sn=#userID#*)))"
attributes = "name,samAccountname, ipphone, mail, mobile, title, postalAddress, telephoneNumber,facsimileTelephoneNumber, postalCode, l, physicalDeliveryOfficeName, co">
<cfif #results.name# is "">
<cfreturn "Sorry, no records were found matching: #userID#">
<cfelse>
<cfreturn "Your search for #userID# found:
#results.name#
#results.title#
Office: #results.physicalDeliveryOfficeName#
Address: #results.postalAddress#
Postal code: #results.l# #results.postalCode#
Country: #results.co#
Email: #results.mail#
Tel: #results.telephoneNumber#
Extension: #results.ipphone#
Cell: #results.mobile#
Fax: #results.facsimileTelephoneNumber#"
/>
</cfif>
<cfcatch>
<cfreturn "Oops ... something did not go right">
</cfcatch>
</cftry>
</cffunction>
<cffunction name="todaysPlymouthCafeteriaFeature" access="remote" returnType="String">
<cfset myMenuRead = ""/>
<cfset todayName = "#DayofWeekAsString(DayOfWeek(Now()))#">
<cfset todayField = "this#todayName#"/>
<cfquery datasource="Cafeteria" name="todaysMenuRead">
select itemName, itemDesc from MenuItems mi, ThisWeek tw where weekNo = #(Week(Now()))# and mi.itemNo = tw.#todayField#
</cfquery>
<cfset todaysFeature = "#todaysMenuRead.itemName#: #todaysMenuRead.itemDesc#"/>
<cfreturn "On #todayName#, #DateFormat(Now(),'medium')#, the Plymouth Cafeteria is featuring#chr(10)##todaysFeature#">
</cffunction>
<cffunction name="locations">
<cftry>
<cfquery name="getLocs" datasource="ipmdProd">
SELECT name from dbo.location ORDER BY name
</cfquery>
<cfset arLocs=ArrayNew(1)/>
<cfoutput query="getLocs">
<cfset ArrayAppend(arLocs,#getLocs.name#)/>
</cfoutput>
<cfset locList=ArrayToList(arLocs, "#chr(10)#")>
<cfreturn "Here is the list of FNGP locations:#chr(10)##locList#"/>
<cfcatch>
<cfreturn "Oops ... something did not go right"/>
</cfcatch>
</cftry>
</cffunction>
<cffunction name="divisions">
<cftry>
<cfquery name="getDivs" datasource="locations">
SELECT name from dbo.Division ORDER BY name
</cfquery>
<cfset arDivs=ArrayNew(1)/>
<cfoutput query="getDivs">
<cfset ArrayAppend(arDivs,#getDivs.name#)/>
</cfoutput>
<cfset divList=ArrayToList(arDivs, "#chr(10)#")>
<cfreturn "Here is the list of FNGP divisions:#chr(10)##divList#"/>
<cfcatch>
<cfreturn "Oops ... something did not go right"/>
</cfcatch>
</cftry>
</cffunction>
<cffunction name="recordTime">
<cfargument name="CFEvent">
<cfset message = CFEvent.data.message>
<cftry>
<cfset RegExp = REFindNoCase("(\\\\)(.*)(\\)(.*)", message, 1, True)>
<cfif RegExp.len[1] gt 0>
<cfset project = mid(message, RegExp.pos[3], RegExp.len[3])>
<cfset activity = mid(message, RegExp.pos[5], RegExp.len[5])>
<cfset userId = getSenderId(CFEvent)>
<cfquery name="getProjId" datasource="timesheets">
select id from dbo.project p where p.name = '#project#'
</cfquery>
<cfoutput query="getProjId">
<cfset projId = "#getProjId.id#">
</cfoutput>
<cfquery name="addProjActivity" datasource="timesheets" debug="yes">
INSERT INTO dbo.activity
VALUES
('#activity#',getDate(),#projId#,#userId#)
</cfquery>
<cfreturn "added activity record">
<cfelse>
<cfreturn "Could not recognize your input. Please specify \\project\activity">
</cfif>
<cfcatch>
</cfcatch>
</cftry>
</cffunction>
<cffunction name="getTimeStamp">
<cfargument name="CFEvent">
<cfreturn ToString(CreateODBCDateTime(Now()))>
</cffunction>
<cffunction name="getSenderId">
<cfargument name="CFEvent">
<cfquery name="getUserId" datasource="timesheets" debug="yes">
select id from dbo.person p where p.dn = '#CFEvent.originatorID#'
</cfquery>
<cfoutput query="getUserId">
<cfset userId = ToString(#getUserId.id#)>
</cfoutput>
<cfreturn userId>
</cffunction>
<cffunction name="addSenderIdToProjects">
<cfargument name="CFEvent">
<cfset message = CFEvent.data.message>
<cfset RegExp = REFindNoCase("(.*)(\\)(.*)(\\)(.*)", message, 1, True)>
<cfif RegExp.len[1] gt 0>
<cfset userName = mid(message, RegExp.pos[4], RegExp.len[4])>
<cfset userLogin = mid(message, RegExp.pos[6], RegExp.len[6])>
</cfif>
<cfquery name="addUserId" datasource="timesheets" debug="yes">
insert into dbo.person values('#userName#','#userLogin#','#CFEvent.originatorID#')
</cfquery>
<cfreturn "">
</cffunction>
<cffunction name="ListProjects">
<cfquery name="getProjects" datasource="timesheets">
select name, description from dbo.project
</cfquery>
<cfset projects=ArrayNew(1)/>
<cfoutput query="getProjects">
<cfset ArrayAppend(projects,"#getProjects.name# - #getProjects.description#")/>
</cfoutput>
<cfset projList=ArrayToList(projects, "#chr(10)#")>
<cfreturn "Here is the list of project names:#chr(10)##projList#"/>
</cffunction>
</cfcomponent>
Result:
11/30 11:17:30 Information [Chuck the postman's dispatching thread.6] - SAMETIMEGateway (Sametime Project Bot) Connection lost due to: ProjectBot was disconnected from the SAMETIME IM SERVER
11/30 11:17:30 Information [Chuck the postman's dispatching thread.5] - SAMETIMEGateway (Sametime Bot 1) Connection lost due to: stbot was disconnected from the SAMETIME IM SERVER
11/30 11:17:30 Information [Chuck the postman's dispatching thread.6] - SAMETIMEGateway (Sametime Project Bot) Initializing IM gateway with configuration file \\plymsqldev\e$\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\gateway\config\sametime_proj-bot.cfg
11/30 11:17:30 Information [Chuck the postman's dispatching thread.5] - SAMETIMEGateway (Sametime Bot 1) Initializing IM gateway with configuration file \\plymsqldev\e$\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\gateway\config\sametime.cfg
11/30 11:17:30 Information [Chuck the postman's dispatching thread.5] - SAMETIMEGateway (Sametime Bot 1) Connecting to IM Server with username: 'stbot'
11/30 11:17:30 Information [Chuck the postman's dispatching thread.6] - SAMETIMEGateway (Sametime Project Bot) Connecting to IM Server with username: 'ProjectBot'
11/30 11:17:32 Information [Chuck the postman's dispatching thread.7] - SAMETIMEGateway (Sametime Project Bot) Connection lost due to: ProjectBot was disconnected from the SAMETIME IM SERVER
11/30 11:17:32 Error [jrpp-47] - Invalid request of Application.cfm, Application.cfc, or OnRequestEnd.cfm file.You have requested a page with the name Application.cfm. This file name is reserved by the ColdFusion engine for the specification of application level settings; as a result, it cannot be directly requested from a web client. <p> If you are creating a template that is intended for direct access by end users, use a name other than Application.cfm or OnRequestEnd.cfm. The specific sequence of files included or processed is: E:\inetpub\wwwroot\Application.cfm'
11/30 11:17:33 Information [Chuck the postman's dispatching thread.8] - SAMETIMEGateway (Sametime Bot 1) Connection lost due to: stbot was disconnected from the SAMETIME IM SERVER
11/30 11:18:00 Error [Chuck the postman's dispatching thread.5] - SAMETIMEGateway (Sametime Bot 1) Error while reconnecting due to: Unable to connect to SAMETIME server for user stbot.
11/30 11:18:00 Error [Chuck the postman's dispatching thread.6] - SAMETIMEGateway (Sametime Project Bot) Error while reconnecting due to: Unable to connect to SAMETIME server for user ProjectBot.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3036924
External Customer Info:
External Company:
External Customer Name: Sam Juvonen
External Customer Email: 33C46D88446125DB992016B7
External Test Config: 12/02/2008
Attachments:
Comments: