pulsar-client-go icon indicating copy to clipboard operation
pulsar-client-go copied to clipboard

Avoid parsing nil msg.Value

Open smazurov opened this issue 3 years ago • 0 comments

Motivation

Today, you are forced to use internal schema encoding when sending messages to a topic that has a schema defined. If we do message encoding (into bytes) before hand, set that as a payload but leave value empty, the internal schema encoder fails the message since Value isn't set. This change makes it possible to easily skip this logic without resorting to hacking a Schema interface or other things like double encoding.

This change would also make it a lot easier to get a watermill adapter in place because watermill assumes message encoding happens in "userland".

Modifications

A simple check to ensure msg.Value is not nil

Verifying this change

  • [x] Make sure that the change passes the CI checks.

This change is already covered by existing tests

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API: no
  • The schema: maybe
  • The default values of configurations: maybe
  • The wire protocol: no

smazurov avatar Jul 27 '21 14:07 smazurov