当我呼叫SNS服务器时,我面临着SNS端点被禁用的问题。为了调试,我添加了日志。在日志中显示为真,而在亚马逊SNS中显示为假。请告诉我如何处理这种情况
下面是我编写的用于设置端点属性的代码。
$enable_end_point = $client->setEndpointAttributes(array(
'Endpoenter code hereintArn' => $pushlist[$i]['aws'],
'Attributes' => array(
'Enabled' => 'true'
)`enter code here`
));
我从Amazon SNS服务器获得的日志响应
data: get paramsGuzzleServiceResourceModel Object(
[structure:protected] =>
[data:protected] => Array
(
[Attributes] => Array(
[Enabled] => true
[Token] => xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
)
[ResponseMetadata] => Array(
[RequestId] => 1ef66366-6dc3-549a-8d38-2d4a5axxxxx
)
)
)
发布通知
$result = $client->publish(array(
'TargetArn' => $pushlist[$i]['aws'],
'Message' => $msg_json,
'Subject' => 'New xxxxx',
'MessageStructure' => 'json',
));
发表日志:
data: publish resultGuzzleServiceResourceModel Object
(
[structure:protected] =>
[data:protected] => Array
(
[MessageId] => 5bbeb85f-75e7-5967-a55a-f673424xxxxx
[ResponseMetadata] => Array
(
[RequestId] => 5c7f3df2-ff65-5bb5-a74a-73dec8cxxxxx
)
)
)
发布后,我通过日志检查端点状态
data: get params after publishGuzzleServiceResourceModel Object
(
[structure:protected] =>
[data:protected] => Array
(
[Attributes] => Array
(
[Enabled] => true
[Token] => xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
)
[ResponseMetadata] => Array
(
[RequestId] => f3bdbb0d-9666-5b38-84a0-f521a1cxxxxx
)
)
)
在上面的响应中,我将端点状态获取为true。但是我没有收到任何推送通知,在亚马逊的SNS状态显示为假。
问候,
来自
我认为你发送的属性是Enabled为true,
$enable_end_point = $client->setEndpointAttributes(array(
'Endpoenter code hereintArn' => $pushlist[$i]['aws'],
'Attributes' => array(
'Enabled' => 'true'
)
));
这是你在日志中得到的为真,而在AWS SNS应用程序中实际是假的。
请尝试这个来查找arn启用状态是false还是true。
$endpointAtt = $sns->getEndpointAttributes($arn_arr);
Log::info($endpointAtt['Attributes']);
if($endpointAtt != 'failed' && $endpointAtt['Attributes']['Enabled'] != 'false') {
// Code here
}