繁体   English   中英

在PHP中禁用Amazon SNS端点但是当我记录响应时,我将端点状态设置为已启用

[英]Amazon SNS endpoint getting disabled in php But when I log the response I am getting endpoint status as enabled

我在调用SNS服务器时遇到SNS端点被禁用的问题。 为了调试,我添加了日志。 在日志中,它显示为true,在Amazon SNS中显示为false。 请帮我解决问题

以下是我为设置端点Atrributes而编写的代码。

$enable_end_point = $client->setEndpointAttributes(array(
    'Endpoenter code hereintArn' => $pushlist[$i]['aws'],
    'Attributes' => array(
    'Enabled' => 'true'
    )`enter code here`
));

我从Amazon SNS服务器获取日志响应

data: get paramsGuzzle\Service\Resource\Model 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 resultGuzzle\Service\Resource\Model Object
(
    [structure:protected] => 
    [data:protected] => Array
    (
        [MessageId] => 5bbeb85f-75e7-5967-a55a-f673424xxxxx
        [ResponseMetadata] => Array
        (
            [RequestId] => 5c7f3df2-ff65-5bb5-a74a-73dec8cxxxxx
        )

    )
)

发布后,我通过日志检查端点状态

data: get params after publishGuzzle\Service\Resource\Model Object
(
    [structure:protected] => 
    [data:protected] => Array
    (
        [Attributes] => Array
        (
            [Enabled] => true
            [Token] => xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        )
        [ResponseMetadata] => Array
        (
            [RequestId] => f3bdbb0d-9666-5b38-84a0-f521a1cxxxxx
        )

    )
)

在上面的响应中,我的端点状态为true。 但我没有得到任何推送通知,并且在Amazon SNS状态显示为false。

问候,

Vamsi

我认为你发送的属性为Enabled为true,

$enable_end_point = $client->setEndpointAttributes(array(
    'Endpoenter code hereintArn' => $pushlist[$i]['aws'],
    'Attributes' => array(
    'Enabled' => 'true'
    )
));

这就是您在日志中获得的结果,并且AWS SNS应用程序中的实际值为false。

请尝试这个,以找到arn启用状态为false或true。

$endpointAtt = $sns->getEndpointAttributes($arn_arr);
Log::info($endpointAtt['Attributes']);
if($endpointAtt != 'failed' && $endpointAtt['Attributes']['Enabled'] != 'false') {
   // Code here
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM