We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
/area runtime
1.2.x
When using the outbox pattern in v1.12, the CloudEvent message must have all the field filled like in a normal pub-sub event.
{ "messageId": "sxauFohHeQwaDAjExBCzWl", "metadata": "{"cloudevent.type":"licmanager.contract.company.created"}", "body": { "data": { "billingAddress": { "city": "Wsp", "country": "Belgium", "postalCode": "1150", "stateProvince": "Brussels", "streetAddress": "Avenue des Cerisiers" }, "id": "2e48c277-8edf-4b34-be8f-40ad0dd942f2", "name": "Test1", "vat": null }, "datacontenttype": "application/json", "id": "786ce798-9055-4b05-8ee7-adef60d817b5", "pubsubname": "contract-only-pubsub", "source": "licmanager-contract", "specversion": "1.0", "time": "2023-10-16T22:19:54+02:00", "topic": "contract-domain-events", "traceid": "00-90e2e408784262d4d9f62e802dfd7057-aaac747362a48de0-00", "traceparent": "00-90e2e408784262d4d9f62e802dfd7057-aaac747362a48de0-00", "tracestate": "", "type": "licmanager.contract.company.created" }, "timestamp": "2023-10-16 20:19:54", "sequence": 23, "tags": "{"ContentType":""}" }
Some fields are not filled!
{ "messageId": "sxauFohHeQwaDAjExBCzeZ", "body": { "data": "{"Id":"2e48c277-8edf-4b34-be8f-40ad0dd942f2","Name":"Test1","VAT":null,"BillingAddress":{"StreetAddress":"Avenue des Cerisiers","City":"Wsp","PostalCode":"1150","StateProvince":"Brussels","Country":"Belgium"}}", "datacontenttype": "text/plain", "id": "944cecf8-d45b-41b0-9529-e09d830adf33", "pubsubname": "contract-only-pubsub", "source": "licmanager-contract", "specversion": "1.0", "time": "2023-10-16T22:22:54+02:00", "topic": "contract-domain-events", "traceid": "", "traceparent": "", "tracestate": "", "type": "com.dapr.event.sent" }, "timestamp": "2023-10-16 20:22:54", "sequence": 24, "tags": "{"ContentType":"text/plain"}" }
The DataContent type is also not correct => text/plain instead of application/json
apiVersion: dapr.io/v2alpha1 kind: Subscription metadata: name: user spec: topic: contract-domain-events pubsubname: contract-only-pubsub routes: default: /dapr/outboxevent deadLetterTopic: poisonMessages
scopes:
Test with pub-sub
var entity = _mapper.Map(entityResult.Value); await _dapr.PublishEventAsync("contract-only-pubsub", "contract-domain-events", entity, cancellationToken: cancellationToken, metadata: new Dictionary<string, string> { { "cloudevent.type", "licmanager.contract.company.created" } })).ConfigureAwait(false);
Give the correct message!
Use the outbox pattern
var entity = _mapper.Map<CompanyCreated>(entityResult.Value); var requests = new List<StateTransactionRequest>() { new($"{entity.Id}", _serializer.Serialize(entity) , StateOperationType.Upsert, metadata:new Dictionary<string, string> { { "ttlInSeconds", "60" } }) }; await _dapr.ExecuteStateTransactionAsync("contract-outbox", requests, cancellationToken: cancellationToken).ConfigureAwait(false);
=> will give the expected message.
RELEASE NOTE:
The text was updated successfully, but these errors were encountered:
Extending outbox with the ability to set metadata for the cloud-event is what's needed to support this, and this is a good feature request!
Sorry, something went wrong.
yaron2
Successfully merging a pull request may close this issue.
In what area(s)?
/area runtime
What version of Dapr?
Expected Behavior
When using the outbox pattern in v1.12, the CloudEvent message must have all the field filled like in a normal pub-sub event.
{
"messageId": "sxauFohHeQwaDAjExBCzWl",
"metadata": "{"cloudevent.type":"licmanager.contract.company.created"}",
"body": {
"data": {
"billingAddress": {
"city": "Wsp",
"country": "Belgium",
"postalCode": "1150",
"stateProvince": "Brussels",
"streetAddress": "Avenue des Cerisiers"
},
"id": "2e48c277-8edf-4b34-be8f-40ad0dd942f2",
"name": "Test1",
"vat": null
},
"datacontenttype": "application/json",
"id": "786ce798-9055-4b05-8ee7-adef60d817b5",
"pubsubname": "contract-only-pubsub",
"source": "licmanager-contract",
"specversion": "1.0",
"time": "2023-10-16T22:19:54+02:00",
"topic": "contract-domain-events",
"traceid": "00-90e2e408784262d4d9f62e802dfd7057-aaac747362a48de0-00",
"traceparent": "00-90e2e408784262d4d9f62e802dfd7057-aaac747362a48de0-00",
"tracestate": "",
"type": "licmanager.contract.company.created"
},
"timestamp": "2023-10-16 20:19:54",
"sequence": 23,
"tags": "{"ContentType":""}"
}
Actual Behavior
Some fields are not filled!
{
"messageId": "sxauFohHeQwaDAjExBCzeZ",
"body": {
"data": "{"Id":"2e48c277-8edf-4b34-be8f-40ad0dd942f2","Name":"Test1","VAT":null,"BillingAddress":{"StreetAddress":"Avenue des Cerisiers","City":"Wsp","PostalCode":"1150","StateProvince":"Brussels","Country":"Belgium"}}",
"datacontenttype": "text/plain",
"id": "944cecf8-d45b-41b0-9529-e09d830adf33",
"pubsubname": "contract-only-pubsub",
"source": "licmanager-contract",
"specversion": "1.0",
"time": "2023-10-16T22:22:54+02:00",
"topic": "contract-domain-events",
"traceid": "",
"traceparent": "",
"tracestate": "",
"type": "com.dapr.event.sent"
},
"timestamp": "2023-10-16 20:22:54",
"sequence": 24,
"tags": "{"ContentType":"text/plain"}"
}
The DataContent type is also not correct => text/plain instead of application/json
Steps to Reproduce the Problem
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: contract-outbox
spec:
type: state.redis
version: v1
metadata:
value: localhost:6379
value: ""
value: "contract-only-pubsub"
value: "contract-domain-events"
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: contract-only-pubsub
spec:
type: pubsub.kubemq
version: v1
metadata:
value: "localhost:40000"
value: true
value: licmanage-contract
scopes:
apiVersion: dapr.io/v2alpha1
kind: Subscription
metadata:
name: user
spec:
topic: contract-domain-events
pubsubname: contract-only-pubsub
routes:
default: /dapr/outboxevent
deadLetterTopic: poisonMessages
scopes:
Test with pub-sub
var entity = _mapper.Map(entityResult.Value);
await _dapr.PublishEventAsync("contract-only-pubsub", "contract-domain-events", entity, cancellationToken: cancellationToken, metadata: new Dictionary<string, string> { { "cloudevent.type", "licmanager.contract.company.created" } })).ConfigureAwait(false);
Give the correct message!
Use the outbox pattern
=> will give the expected message.
RELEASE NOTE:
The text was updated successfully, but these errors were encountered: