CDK Tweet Queue

raw JSON →
2.0.949 verified Sat May 09 auth: no python

An AWS CDK construct that creates an SQS queue populated with tweets from a search query. Version 2.0.949, released weekly.

pip install cdk-tweet-queue
error ModuleNotFoundError: No module named 'tweet_queue'
cause Import path uses incorrect hyphenated name instead of underscores.
fix
Use from cdk_tweet_queue import TweetQueue
error jsii.errors.JSIIError: Cannot resolve resource 'arn:aws:sqs:...'
cause Trying to pass an existing SQS queue to the construct which creates its own.
fix
Do not provide a queue; use queue.queue to reference the created queue.
error AttributeError: 'TweetQueue' object has no attribute 'queue_arn'
cause Old property name before v2 update.
fix
Use queue.queue.queue_arn or the queue attribute.
breaking The construct creates an SQS queue internally; do not provide your own queue – use the exposed queue attribute.
fix Access the queue via `queue.queue` after construction.
deprecated The `query` parameter previously supported Twitter API v1.1 endpoints; migrate to v2 if using OAuth 2.0.
fix Ensure your Twitter developer credentials are for API v2. See changelog for migration.
gotcha The `consumer_timeout` must be a positive integer (in seconds). Negative or zero values cause deployment failure.
fix Set `consumer_timeout` to a value >= 60 seconds, e.g., 300.

Create an SQS queue that streams tweets matching a search query.

from aws_cdk import App, Stack
from aws_cdk import aws_sqs as sqs
from cdk_tweet_queue import TweetQueue

app = App()
stack = Stack(app, "MyStack")

queue = TweetQueue(
    stack,
    "MyTweetQueue",
    query="#python",
    consumer_timeout=300,
    max_receive_count=3,
    retry_attempts=3,
)

app.synth()