Skip to content

Commit

Permalink
fix attach existing queue to stack
Browse files Browse the repository at this point in the history
  • Loading branch information
fogfish committed Sep 29, 2024
1 parent 4d25de2 commit 8e9411b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions broker/eventsqs/awscdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ func (broker *Broker) NewQueue(props *awssqs.QueueProps) awssqs.IQueue {
return broker.Queue
}

func (broker *Broker) AddQueue(queueName string) awssqs.IQueue {
func (broker *Broker) AddQueue(queueArn *string) awssqs.IQueue {
broker.Queue = awssqs.Queue_FromQueueAttributes(broker.Construct, jsii.String("Bus"),
&awssqs.QueueAttributes{
QueueName: jsii.String(queueName),
QueueArn: queueArn,
},
)

Expand Down
15 changes: 12 additions & 3 deletions broker/eventsqs/examples/serverless/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,22 @@ func main() {
)

broker := eventsqs.NewBroker(stack, jsii.String("Broker"), nil)
broker.NewQueue(nil)
broker.AddQueue(
stack.FormatArn(
&awscdk.ArnComponents{
Service: jsii.String("sqs"),
Account: awscdk.Aws_ACCOUNT_ID(),
Region: awscdk.Aws_REGION(),
Resource: jsii.String("swarm-test"),
},
),
)

broker.NewSink(
&eventsqs.SinkProps{
Function: &scud.FunctionGoProps{
SourceCodeModule: "github.com/fogfish/swarm",
SourceCodeLambda: "examples/eventsqs/dequeue",
SourceCodeModule: "github.com/fogfish/swarm/broker/eventsqs",
SourceCodeLambda: "examples/dequeue/typed",
},
},
)
Expand Down

0 comments on commit 8e9411b

Please sign in to comment.