Ejemplo n.º 1
0
        public static UserRecord make_user_record(
            string partition_key     = "abcd",
            string data              = "1234",
            string explicit_hash_key = "",
            long deadlineMS          = 100000,
            string stream            = "myStream",
            ulong source_id          = 0)
        {
            Aws.Kinesis.Protobuf.Message m = new Aws.Kinesis.Protobuf.Message();
            m.Id        = source_id;
            m.PutRecord = new Aws.Kinesis.Protobuf.PutRecord();
            m.PutRecord.PartitionKey = partition_key;
            m.PutRecord.StreamName   = stream;
            if (!string.IsNullOrEmpty(explicit_hash_key))
            {
                m.PutRecord.ExplicitHashKey = explicit_hash_key;
            }

            m.PutRecord.Data = Google.Protobuf.ByteString.CopyFrom(data, Encoding.Default);
            var r = new UserRecord(m);

            r.set_deadline_from_now(deadlineMS);
            r.set_expiration_from_now(deadlineMS * 2);
            return(r);
        }
Ejemplo n.º 2
0
        public static string SerializeAsString(this Aws.Kinesis.Protobuf.Message message)
        {
            var byteString = message.ToByteString();

            return(byteString.ToString(Encoding.Default));
        }