amazon web services - SNS GetEndpointAttributes & Publish to Endpoint not available in .Net SDK -
i using v2.5.26.2, runtime version v2.0.50727 of aws sdk .net , noticed getendpointattributes calls not available sns client, nor can target endpoint arn in publish request message.
the documentation api, getendpointattributes method ,for sns indicates should able both of things.
i tired asking question on aws support forums figure out why call not available have yet receive reply more week later.
i tried several web searches problem no avail.
is limitation of .net sdk or perhaps limitation of version using? if so, there workaround make either of these calls.
edit: code samples requested (although not show since objects not getting recognized
getendpointattributes
so according amazon documentation getendpointattributes first need create class derives virtual class getendpointattributes so.
using system; using system.collections.generic; using system.linq; using system.text; using amazon.simplenotificationservice; using amazon.simplenotificationservice.model; namespace company.project.sns { public class snsgetendpointattributes : getendpointattributes { } }
which creates following compiler error
the type or namespace name 'getendpointattributes' not found
you should try endpoints subscribed application making request using arn. response contains collection endpoints , attributes, can search match , retrieve attributes:
public dictionary<string, string> getendpointattributes(string platformarn, string endpointarn) { var listplatformendpointsrequest = new listendpointsbyplatformapplicationrequest(); listplatformendpointsrequest.platformapplicationarn = platformarn; var response = snsclient.listendpointsbyplatformapplication(listplatformendpointsrequest); dictionary<string, string> endpointattributes = response.endpoints.exists(x => x.endpointarn.equals(endpointarn)) ? response.endpoints.find(x => x.endpointarn.equals(endpointarn)).attributes : null; return endpointattributes; }
i'm not sure mean when can't target endpoint arn, because every time subscribe endpoint should storing arn inside db or that. anyway, here sample publish message if can access endpoint arn:
public void sendmessage(string endpointarn, string message) { var request = new publishrequest(); request.message = message; request.targetarn = endpointarn; var response = snsclient.publish(request); return response; }
hope you.
Comments
Post a Comment