Skip to content

[Bug] CloudEvents variable names do not support underscores #4623

@mxsm

Description

@mxsm

Search before asking

  • I had searched in the issues and found no similar issues.

Environment

Windows

EventMesh version

master

What happened

CloudEvents variable names do not support underscores。

How to reproduce

    public static void main(String[] args) {
        CloudEvent.Builder builder = CloudEvent.newBuilder().setId(RandomStringUtils.generateUUID()).setSpecVersion("1.0")
            .putAttributes(ProtocolKey.GRPC_RESPONSE_CODE, CloudEventAttributeValue.newBuilder().setCeString("").build())
            .putAttributes(ProtocolKey.GRPC_RESPONSE_MESSAGE,
                CloudEventAttributeValue.newBuilder().setCeString("").build())
            .putAttributes(ProtocolKey.GRPC_RESPONSE_TIME, CloudEventAttributeValue.newBuilder()
                .setCeTimestamp(Timestamp.newBuilder().setSeconds(1).build()).build());
        final io.cloudevents.CloudEvent cloudEvent = switchEventMeshCloudEvent2CloudEvent(builder.build());
    }

Debug logs

Exception in thread "main" io.cloudevents.rw.CloudEventRWException: Invalid extensions name: status_code
at io.cloudevents.rw.CloudEventRWException.newInvalidExtensionName(CloudEventRWException.java:122)
at io.cloudevents.core.impl.BaseCloudEventBuilder.withExtension(BaseCloudEventBuilder.java:121)
at io.cloudevents.core.v1.CloudEventBuilder.withContextAttribute(CloudEventBuilder.java:176)
at io.cloudevents.protobuf.ProtoDeserializer.read(ProtoDeserializer.java:73)
at io.cloudevents.rw.CloudEventReader.read(CloudEventReader.java:43)
at io.cloudevents.protobuf.ProtobufFormat.deserialize(ProtobufFormat.java:64)
at io.cloudevents.core.format.EventFormat.deserialize(EventFormat.java:56)
at org.apache.eventmesh.client.grpc.util.EventMeshCloudEventBuilder.switchEventMeshCloudEvent2CloudEvent(EventMeshCloudEventBuilder.java:272)
at org.apache.eventmesh.client.grpc.util.EventMeshCloudEventBuilder.main(EventMeshCloudEventBuilder.java:294)

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions