-
Notifications
You must be signed in to change notification settings - Fork 41
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
Cloudevent spec fields are lost when publish to a NATS subject #597
Comments
Hey, is it the latest 1.15 version? I know about this bug, I fixed in a PR which adds also experimental pull-consumers https://github.com/knative-extensions/eventing-natss/pull/587/files#diff-c369cb6bcf8ad0f92682328cc07052862bafb7a7000324c3a66a24fbbf71040dR389 I will take a look on the next week if it is present in 1.15 version and patch-fix it there. |
Hi, I'm talking about this code func (a *CloudeventExtractorTransformer) Transform(reader binding.MessageMetadataReader, _ binding.MessageMetadataWriter) error {
spec_fields := []spec.Kind{
spec.ID,
spec.Source,
spec.SpecVersion,
spec.Type,
spec.DataContentType,
spec.DataSchema,
spec.Subject,
spec.Time,
}
// fetch spec
for _, f := range spec_fields {
_, ty := reader.GetAttribute(f)
if ty != nil {
tyParsed, err := types.ToString(ty)
if err != nil {
return err
}
(*a)[fmt.Sprintf("ce-%s", f.String())] = tyParsed
}
} PS. right now we're working on latest commit of the main branch |
with the fix I mentioned you will get data and headers as nats message data, so called cloud event structured mode
I'll provide a fix on this week and you will be able to try it. A possible problem in your code would be missing extension headers, e.g. you want to add your custom CE header |
Hey, @omgbebebe , please check #599 , the issue is fixed in the PR. |
Problem
When coudevent is published to a NATS subject, all fields except the
data
field are lost. This behavior is more like a gateway than a transport between NATS and Cloudevent systems. This forces us to carry all metadata in the payload to be able to differentiate events by source or subject. I don't know about the design decisions in this project, and maybe it works as intended, but for our purposes it is a real blocker.Persona:
I believe it's an
Event producer
Exit Criteria
natss
processingTime Estimate (optional):
I can't say
Additional context (optional)
in our project we have a quick'n'dirty patch to address this issue but I really not so good in goland and I strongly believe that this can be coded in a more elegant way. I also haven't found a way to get extension headers, if any, from Cloudevent without major codebase refactoring. Maybe I'm missing something obvious.
Right now we're able to receive a NATS message with proper Cloudevent metadata. Like:
without our patch it looks like
This is definitely not enough to properly route the message further down the processing bus.
The text was updated successfully, but these errors were encountered: