Answered
SetLocale no effect in event gateway
SetLocale() is ignored when a CFC is called through an event
gateway. SetLocale() works fine when called through an ordinary
HTTP request. When called through the gateway the locale is always
set as default locale that the server JVM instance was installed
with.
Does anybody have a workaround for this?
We use MX7.
Here is some example code if you want to test:
<cfset message = StructNew()>
<cfset message.method = "onTest">
<cfset pushQueue = SendGatewayMessage("LocaleTest",message)>
Create a gateway "LocaleTest" pointing to "LocaleText.cfc" which looks like this:
<cfcomponent>
<cffunction name="onTest" output="no">
<cfargument name="CFEvent" type="struct" required="yes">
<!--- choose a different locale then your server default --->
<cfset SetLocale("en_GB")>
<cffile action="append" file="c:\temp.log" output="#GetLocale()#">
</cffunction>
</cfcomponent>
You can find the output in c:{temp.log, you will see it doesnt take the locale set by SetLocale()
Does anybody have a workaround for this?
We use MX7.
Here is some example code if you want to test:
<cfset message = StructNew()>
<cfset message.method = "onTest">
<cfset pushQueue = SendGatewayMessage("LocaleTest",message)>
Create a gateway "LocaleTest" pointing to "LocaleText.cfc" which looks like this:
<cfcomponent>
<cffunction name="onTest" output="no">
<cfargument name="CFEvent" type="struct" required="yes">
<!--- choose a different locale then your server default --->
<cfset SetLocale("en_GB")>
<cffile action="append" file="c:\temp.log" output="#GetLocale()#">
</cffunction>
</cfcomponent>
You can find the output in c:{temp.log, you will see it doesnt take the locale set by SetLocale()
