public PutRecordAsync ( |
||
request | Container for the necessary parameters to execute the PutRecord operation. | |
cancellationToken | System | /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// |
return | Task |
public Task<PutRecordResponse> PutRecordAsync(PutRecordRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var marshaller = new PutRecordRequestMarshaller();
var unmarshaller = PutRecordResponseUnmarshaller.Instance;
return InvokeAsync<PutRecordRequest,PutRecordResponse>(request, marshaller,
unmarshaller, cancellationToken);
}
AmazonKinesisClient::PutRecordAsync ( |
public async Task<IHttpActionResult> Post() { var o = new { Message = "Hello World", Author = "David Judd" }; //convert to byte array in prep for adding to stream byte[] oByte = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(o)); //create client that pulls creds from web.config and takes in Kinesis config var client = new AmazonKinesisClient(Config); using (MemoryStream ms = new MemoryStream(oByte)) { //create put request PutRecordRequest requestRecord = new PutRecordRequest(); //list name of Kinesis stream requestRecord.StreamName = "shomi_dev"; //give partition key that is used to place record in particular shard requestRecord.PartitionKey = DateTime.Now.Ticks.ToString(); //add record as memorystream requestRecord.Data = ms; //PUT the record to Kinesis var response = await client.PutRecordAsync(requestRecord); return Ok(new { seq = response.SequenceNumber }); } }