dotnet-sdk
dotnet-sdk copied to clipboard
Support publishing other content type than json
We are considering to publish custom CloudEvent to the broker, but currently sdk doesn't support it (The only supported content type is json). It would be great if we could do something similar to invokeBinding and pass ContentType and Data in a raw format encapsulated into the request object to the publishAsync method. It can also address #718 as well)
Suggestion:
public class PublishEventRequest
{
public PublishEventRequest(string pubsubName, string topicName)
{
ArgumentVerifier.ThrowIfNullOrEmpty(pubsubName, nameof(pubsubName));
ArgumentVerifier.ThrowIfNullOrEmpty(topicName, nameof(topicName));
this.PubSubName = pubsubName;
this.TopicName = topicName;
this.Metadata = new Dictionary<string, string>();
}
public string PubSubName { get; }
public string TopicName { get; }
public ReadOnlyMemory<byte> Data { get; set; }
public string DataContentType { get; set; }
public Dictionary<string, string> Metadata { get; }
}
Task PublishEventAsync(PublishEventRequest publishEventRequest, CancellationToken cancellationToken = default)
@msfussell can you please add this issue to our project?
We'll add a new method that will skip the json serialization portion and work on raw bytes instead.
@fabistb - As we discussed in the last call, this issue seems to be really nice to have feature. Please review and close the issue as appropriate.
@rabollin , thanks for getting back here. I checked with @mtaghavi2005 and this topic isn't relevant from our point of view anymore and the issue can be closed.
