/AWS1/IF_SNS=>PUBLISHBATCH()¶
About PublishBatch¶
Publishes up to 10 messages to the specified topic in a single batch. This is a batch
version of the Publish API. If you try to send more than 10 messages in a
single batch request, you will receive a TooManyEntriesInBatchRequest
exception.
For FIFO topics, multiple messages within a single batch are published in the order they are sent, and messages are deduplicated within the batch and across batches for five minutes.
The result of publishing each message is reported individually in the response. Because the batch request can result in a combination of successful and unsuccessful actions, you should check for batch errors even when the call returns an HTTP status code of 200.
The maximum allowed individual message size and the maximum total payload size (the sum of the individual lengths of all of the batched messages) are both 256 KB (262,144 bytes).
The PublishBatch API can send up to 10 messages at a time. If you
attempt to send more than 10 messages in one request, you will encounter a
TooManyEntriesInBatchRequest exception. In such cases, split your
messages into multiple requests, each containing no more than 10 messages.
Some actions take lists of parameters. These lists are specified using the
param.n notation. Values of n are integers starting from
1. For example, a parameter list with two elements
looks like this:
&AttributeName.1=first
&AttributeName.2=second
If you send a batch message to a topic, Amazon SNS publishes the batch message to each endpoint that is subscribed to the topic. The format of the batch message depends on the notification protocol for each subscribed endpoint.
When a messageId is returned, the batch message is saved, and Amazon SNS
immediately delivers the message to subscribers.
Method Signature¶
METHODS /AWS1/IF_SNS~PUBLISHBATCH
IMPORTING
!IV_TOPICARN TYPE /AWS1/SNSTOPICARN OPTIONAL
!IT_PUBBATCHREQUESTENTRIES TYPE /AWS1/CL_SNSPUBBATCHREQENTRY=>TT_PUBBATCHREQUESTENTRYLIST OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_snspublishbatchrsp
RAISING
/AWS1/CX_SNSAUTHERROREXCEPTION
/AWS1/CX_SNSBTCENTIDSNOTDIST00
/AWS1/CX_SNSBATCHREQTOOLONGEX
/AWS1/CX_SNSEMPTYBATCHREQEX
/AWS1/CX_SNSENDPOINTDISABLEDEX
/AWS1/CX_SNSINTERNALERROREX
/AWS1/CX_SNSINVBATCHENTRYIDEX
/AWS1/CX_SNSINVALIDPARAMETEREX
/AWS1/CX_SNSINVPARAMVALUEEX
/AWS1/CX_SNSINVALIDSECURITYEX
/AWS1/CX_SNSKMSACCESSDENIEDEX
/AWS1/CX_SNSKMSDISABLEDEX
/AWS1/CX_SNSKMSINVALIDSTATEEX
/AWS1/CX_SNSKMSNOTFOUNDEX
/AWS1/CX_SNSKMSOPTINREQUIRED
/AWS1/CX_SNSKMSTHROTTLINGEX
/AWS1/CX_SNSNOTFOUNDEXCEPTION
/AWS1/CX_SNSPLATFORMAPPLICAT00
/AWS1/CX_SNSTOOMANYENTRIESIN00
/AWS1/CX_SNSVALIDATIONEX
/AWS1/CX_SNSCLIENTEXC
/AWS1/CX_SNSSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_topicarn TYPE /AWS1/SNSTOPICARN /AWS1/SNSTOPICARN¶
The Amazon resource name (ARN) of the topic you want to batch publish to.
it_pubbatchrequestentries TYPE /AWS1/CL_SNSPUBBATCHREQENTRY=>TT_PUBBATCHREQUESTENTRYLIST TT_PUBBATCHREQUESTENTRYLIST¶
A list of
PublishBatchrequest entries to be sent to the SNS topic.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_snspublishbatchrsp /AWS1/CL_SNSPUBLISHBATCHRSP¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->publishbatch(
it_pubbatchrequestentries = VALUE /aws1/cl_snspubbatchreqentry=>tt_pubbatchrequestentrylist(
(
new /aws1/cl_snspubbatchreqentry(
it_messageattributes = VALUE /aws1/cl_snsmessageattrvalue=>tt_messageattributemap(
(
VALUE /aws1/cl_snsmessageattrvalue=>ts_messageattributemap_maprow(
key = |string|
value = new /aws1/cl_snsmessageattrvalue(
iv_binaryvalue = '5347567362473873563239796247513D'
iv_datatype = |string|
iv_stringvalue = |string|
)
)
)
)
iv_id = |string|
iv_message = |string|
iv_messagededuplicationid = |string|
iv_messagegroupid = |string|
iv_messagestructure = |string|
iv_subject = |string|
)
)
)
iv_topicarn = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
LOOP AT lo_result->get_successful( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_string = lo_row_1->get_id( ).
lv_messageid = lo_row_1->get_messageid( ).
lv_string = lo_row_1->get_sequencenumber( ).
ENDIF.
ENDLOOP.
LOOP AT lo_result->get_failed( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_string = lo_row_3->get_id( ).
lv_string = lo_row_3->get_code( ).
lv_string = lo_row_3->get_message( ).
lv_boolean = lo_row_3->get_senderfault( ).
ENDIF.
ENDLOOP.
ENDIF.