-
Notifications
You must be signed in to change notification settings - Fork 22
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
Question about the DetailType parameter #74
Comments
Could you clarify what you mean? I don't understand. |
Sorry for not being clear. @mnapoli . I installed this package to test the following scenario: My application publishes a message to my custom EventBus on AWS using the EventBridge service. Using the AWS SDK to publish a message on the Bus, it is possible to do as follows: // SDK AWS
// https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-eventbridge-2015-10-07.html#putevents
$result = $client->putEvents([
'EndpointId' => '<string>',
'Entries' => [ // REQUIRED
[
'Detail' => '<string>',
'DetailType' => '<string>',
'EventBusName' => '<string>',
'Resources' => ['<string>', ...],
'Source' => '<string>',
'Time' => <integer || string || DateTime>,
'TraceHeader' => '<string>',
],
// ...
],
]); Note that in the AWS example, it is possible to pass the Your class // https://github.com/brefphp/symfony-messenger/blob/master/src/Service/EventBridge/EventBridgeTransport.php
public function send(Envelope $envelope): Envelope
{
$encodedMessage = $this->serializer->encode($envelope);
$arguments = [
'Entries' => [
[
'Detail' => json_encode($encodedMessage, JSON_THROW_ON_ERROR),
// Ideally here we could put the class name of the message, but how to retrieve it?
'DetailType' => 'Symfony Messenger message',
'Source' => $this->source,
],
],
];
if ($this->eventBusName) {
$arguments['Entries'][0]['EventBusName'] = $this->eventBusName;
}
try {
$result = $this->eventBridge->putEvents($arguments);
$failedCount = $result->getFailedEntryCount();
} catch (Throwable $e) {
throw new TransportException($e->getMessage(), 0, $e);
}
if ($failedCount > 0) {
foreach ($result->getEntries() as $entry) {
$reason = $entry->getErrorMessage() ?? 'no reason provided';
throw new TransportException("$failedCount message(s) could not be published to EventBridge: $reason.");
}
}
return $envelope;
} |
Ahh ok, thanks for explaining. There are no specific plans for now, it's open to ideas. I'm happy to merge pull requests or be hired to work on this topic (I don't have an immediate need for this feature personally). |
In the send method of the EventBridgeTransport class I noticed that we don't have control over the DetailType parameter, and this parameter is very important in defining the EventBridge rules.
I noticed it's not on version 1.0 yet, I'd like to know what your plans are.
The text was updated successfully, but these errors were encountered: