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

Use of Rebus with "native" AWS messages? #41

Closed
ThomasEg opened this issue Jun 30, 2022 · 2 comments
Closed

Use of Rebus with "native" AWS messages? #41

ThomasEg opened this issue Jun 30, 2022 · 2 comments
Labels

Comments

@ThomasEg
Copy link
Contributor

ThomasEg commented Jun 30, 2022

We use Rebus extensively and it works great! But one thing annoys me with our current solution. We have a few cases where we get messages from AWS and these don't conform to the format Rebus needs. So we need to have some sort of AWS Lambda function to transform all "native" AWS messages like S3.ObjectCreated into a "rebus-friendly" message. This seems like a bad work-around at best and it is hard to maintain....

An example of a message would be the S3EventNotification which looks like this:

{
	"Records": [{
		"eventVersion": "2.1",
		"eventSource": "aws:s3",
		"awsRegion": "eu-central-1",
		"eventTime": "2022-06-30T08:50:15.572Z",
		"eventName": "ObjectCreated:Put",
		"userIdentity": {
			"principalId": "AWS:xxxxx"
		},
		"requestParameters": {
			"sourceIPAddress": "111.111.111.111"
		},
		"responseElements": {
			"x-amz-request-id": "XFF3WE66ZXXXXXXP",
			"x-amz-id-2": "7HgI9ICJHuazq8nB10RFqdDdeidxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyajiV9FpQIw4Yhtjx"
		},
		"s3": {
			"s3SchemaVersion": "1.0",
			"configurationId": "xxxxxxxxxxx",
			"bucket": {
				"name": "myBucketName",
				"ownerIdentity": {
					"principalId": "A3AXXXXXXXXXX"
				},
				"arn": "arn:aws:s3:::myBucketName"
			},
			"object": {
				"key": "somefile.txt",
				"size": 123,
				"eTag": "786d8a1xxxxxxxxxxxxxxxef2",
				"sequencer": "00XXXXXXXXXXXXXX7"
			}
		}
	}]
}

I tried looking into hooking into the pipeline as discussed somewhere on stack-overflow, but I was getting in over my head and thought that I couldn't be the only person with this issue, so instead i started to think that I must be missing something obvious...

Is there any (good) way of getting these messages through Rebus?

@mookid8000
Copy link
Member

Yeah well, I can definitely see why this would be useful.

BUT Rebus requires the presence of the rbs2-msg-id header with the message's ID.

AND Rebus' SQS transport uses a special envelope for messages to cope with SQS' built-in limitation that messages can have no more than 10 headers.

So there's a couple of built-in obstacles that prevent you from using Rebus directly.

What you COULD do though, as you mention (and this would be my preferred solution), is to map the messages to something Rebus can work with in a Lambda function, or in a background thread in the process that hosts your Rebus endpoint.

@ThomasEg
Copy link
Contributor Author

ThomasEg commented Jun 30, 2022

Hmmm, my least favorite answer;-) But fair enough! It was kinda what I expected. I'll figure out another way...Thanks for the rapid feedback anyways!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants