I am trying to create a flow that sends a push notification via the google cloud messaging service. I have used the mule connector for gcm. However I cannot get it to work. My config:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:gcm="http://www.mulesoft.org/schema/mule/gcm" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/gcm http://www.mulesoft.org/schema/mule/gcm/1.0/mule-gcm.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<gcm:config name="Google_Cloud_Messaging" apiKey="BLANK FOR POSTING" doc:name="Google Cloud Messaging"/>
<flow name="GCMFlow1" doc:name="GCMFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="9000" path="gcm" doc:name="HTTP"/>
<gcm:send-message config-ref="Google_Cloud_Messaging" doc:name="Google Cloud Messaging">
<gcm:registration-ids>
<gcm:registration-id>"APA91bGFeuXKNWuAkaFquqk0Dk45kkb-dBZdo_DLz8Ai8bLkZroQyBcDgw-SrA_B2aw2mnReO78rb9ivvn1Phu2x-eMWJmHmtLEOceC-hBGGQvbbpCvse2ZxvllJkYVP-G-jQrfOLOMF"</gcm:registration-id>
</gcm:registration-ids>
</gcm:send-message>
</flow>
</mule>
I get the following error :
Exception stack is:
1. Numeric value (5587416482739805649) out of range of int
at [Source: org.mule.transport.http.ReleasingInputStream@1318bd3c; line: 1, column: 36] (org.codehaus.jackson.JsonParseException)
org.codehaus.jackson.JsonParser:1433 (null)
2. Failed to invoke sendMessage. Message payload is of type: String (org.mule.api.MessagingException)
org.mule.module.gcm.processors.SendMessageMessageProcessor:236 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.codehaus.jackson.JsonParseException: Numeric value (5587416482739805649) out of range of int
at [Source: org.mule.transport.http.ReleasingInputStream@1318bd3c; line: 1, column: 36]
at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)
at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)
at org.codehaus.jackson.impl.JsonParserBase.convertNumberToInt(JsonParserBase.java:829)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
My api key works as well as registration ID as I have tested them elsewhere.
update: Verbose debug output:
********************************************************************************
Message : Failed to invoke sendMessage. Message payload is of type: String
Type : org.mule.api.MessagingException
Code : MULE_ERROR--2
Payload : "1"
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html
********************************************************************************
Exception stack is:
1. Numeric value (8947223409733149407) out of range of int
at [Source: org.mule.transport.http.ReleasingInputStream@669b824; line: 1, column: 36] (org.codehaus.jackson.JsonParseException)
org.codehaus.jackson.JsonParser:1433 (null)
2. Failed to invoke sendMessage. Message payload is of type: String (org.mule.api.MessagingException)
org.mule.module.gcm.processors.SendMessageMessageProcessor:236 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
********************************************************************************
Root Exception stack trace:
org.codehaus.jackson.JsonParseException: Numeric value (8947223409733149407) out of range of int
at [Source: org.mule.transport.http.ReleasingInputStream@669b824; line: 1, column: 36]
at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)
at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)
at org.codehaus.jackson.impl.JsonParserBase.convertNumberToInt(JsonParserBase.java:829)
at org.codehaus.jackson.impl.JsonParserBase.getIntValue(JsonParserBase.java:625)
at org.codehaus.jackson.map.deser.std.StdDeserializer._parseInteger(StdDeserializer.java:303)
at org.codehaus.jackson.map.deser.std.StdDeserializer$IntegerDeserializer.deserialize(StdDeserializer.java:819)
at org.codehaus.jackson.map.deser.std.StdDeserializer$IntegerDeserializer.deserialize(StdDeserializer.java:806)
at org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299)
at org.codehaus.jackson.map.deser.SettableBeanProperty$MethodProperty.deserializeAndSet(SettableBeanProperty.java:414)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)
at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2732)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1909)
at org.mule.module.gcm.GcmConnector.sendMessage(GcmConnector.java:146)
at org.mule.module.gcm.processors.SendMessageMessageProcessor$1.process(SendMessageMessageProcessor.java:225)
at org.mule.module.gcm.adapters.GcmConnectorProcessAdapter$1.execute(GcmConnectorProcessAdapter.java:36)
at org.mule.module.gcm.processors.SendMessageMessageProcessor.process(SendMessageMessageProcessor.java:211)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:101)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:44)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.construct.AbstractPipeline$1.process(AbstractPipeline.java:112)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExe...
********************************************************************************
NEW Updated FLOW:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:gcm="http://www.mulesoft.org/schema/mule/gcm" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/gcm http://www.mulesoft.org/schema/mule/gcm/1.0/mule-gcm.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<gcm:config name="Google_Cloud_Messaging" apiKey="my_key" doc:name="Google Cloud Messaging"/>
<flow name="GCMFlow1" doc:name="GCMFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="9001" path="gcm" doc:name="HTTP"/>
<set-payload value="APA91bGFeuXKNWuAkaFquqk0Dk45kkb-dBZdo_DLz8Ai8bLkZroQyBcDgw-SrA_B2aw2mnReO78rb9ivvn1Phu2x-eMWJmHmtLEOceC-hBGGQvbbpCvse2ZxvllJkYVP-G-jQrfOLOMF" doc:name="Set Payload"/>
<expression-component doc:name="Expression"><![CDATA[ArrayList idRegID = new ArrayList();
idRegID.add("APA91bGFeuXKNWuAkaFquqk0Dk45kkb-dBZdo_DLz8Ai8bLkZroQyBcDgw-SrA_B2aw2mnReO78rb9ivvn1Phu2x-eMWJmHmtLEOceC-hBGGQvbbpCvse2ZxvllJkYVP-G-jQrfOLOMF");
payload= idRegID;]]></expression-component>
<gcm:send-message config-ref="Google_Cloud_Messaging" doc:name="Google Cloud Messaging">
<gcm:registration-ids ref="#[payload]"/>
</gcm:send-message>
</flow>
</mule>