Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client-kinesis): support eventstream in subscribeToShard #3818

Merged
merged 1 commit into from
Jul 22, 2022

Conversation

AllanZhengYP
Copy link
Contributor

Issue

Fixes: #2131
Fixes: #2418
Related to: smithy-lang/smithy-typescript#573

Description

Codegen for upstream refactor to support event stream in RPC protocols.

Testing

Manual testing:

import {
  DescribeStreamCommand,
  KinesisClient,
  ListStreamConsumersCommand,
  RegisterStreamConsumerCommand,
  SubscribeToShardCommand,
} from "@aws-sdk/client-kinesis";

const client = new KinesisClient({});

const { StreamDescription } = await client.send(
  new DescribeStreamCommand({
    StreamName: "test-data-stream",
  })
);

const { StreamARN } = StreamDescription;

const { Consumers } = await client.send(
  new ListStreamConsumersCommand({
    StreamARN,
  })
);

console.log(Consumers);

let Consumer = Consumers.find((x) => x.ConsumerName == "tester");

if (Consumer == null) {
  const consumerData = await client.send(
    new RegisterStreamConsumerCommand({
      ConsumerName: "tester",
      StreamARN,
    })
  );
  Consumer = consumerData.Consumer;
}

console.log(`StreaARM: ${StreamARN}`);
console.log(`Consumer: ${Consumer.ConsumerARN}`);

const { EventStream } = await client.send(
  new SubscribeToShardCommand({
    ConsumerARN: Consumer.ConsumerARN,
    ShardId: "shardId-000000000000",
    StartingPosition: {
      Type: "LATEST",
    },
  })
);
console.log("Consuming");
for await (const event of EventStream) {
  console.log("EVENT", event);
}

TODO: merge #3810
TODO: add integration test for Kinesis::SubscribeToShard


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AllanZhengYP AllanZhengYP requested a review from a team as a code owner July 21, 2022 17:25
@AllanZhengYP AllanZhengYP merged commit 6892bb9 into aws:main Jul 22, 2022
@github-actions
Copy link

github-actions bot commented Aug 6, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception on SubscribeToShard Command Kinesis SubscribeToShardCommand call does not resolve
2 participants