Skip to content

Commit

Permalink
Allow writing to a given exchange
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillem committed Feb 12, 2024
1 parent 2130166 commit 46fc385
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
@@ -40,6 +40,9 @@ type DestinationConfig struct {

// ContentType is the MIME content type of the messages written to rabbitmq
ContentType string `json:"contentType" default:"text/plain"`

// Exchange is the name of the exchange to publish to
Exchange string `json:"exchange" default:""`
}

func newDestinationConfig(cfg map[string]string) (DestinationConfig, error) {
2 changes: 1 addition & 1 deletion destination.go
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ func (d *Destination) Write(ctx context.Context, records []sdk.Record) (int, err
Body: record.Payload.After.Bytes(),
}

err := d.ch.PublishWithContext(ctx, "", d.config.QueueName, false, false, msg)
err := d.ch.PublishWithContext(ctx, d.config.Exchange, d.config.QueueName, false, false, msg)
if err != nil {
return 0, fmt.Errorf("failed to publish: %w", err)
}

0 comments on commit 46fc385

Please sign in to comment.