File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
src/Atc.Azure.Messaging/EventHub Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public EventHubPublisher(EventHubProducerClient client)
1616
1717 public Task PublishAsync (
1818 object message ,
19- IDictionary < string , string > messageProperties ,
19+ IDictionary < string , string > ? messageProperties = null ,
2020 CancellationToken cancellationToken = default )
2121 {
2222 return PerformPublishAsync (
@@ -27,17 +27,20 @@ public Task PublishAsync(
2727
2828 private Task PerformPublishAsync (
2929 string messageBody ,
30- IDictionary < string , string > messageProperties ,
31- CancellationToken cancellationToken )
30+ IDictionary < string , string > ? messageProperties = null ,
31+ CancellationToken cancellationToken = default )
3232 {
3333 var eventBody = Encoding . UTF8 . GetBytes ( messageBody ) ;
3434 var eventData = new EventData ( eventBody ) ;
3535
36- foreach ( var property in messageProperties )
36+ if ( messageProperties != null )
3737 {
38- eventData . Properties . Add (
39- property . Key ,
40- property . Value ) ;
38+ foreach ( var property in messageProperties )
39+ {
40+ eventData . Properties . Add (
41+ property . Key ,
42+ property . Value ) ;
43+ }
4144 }
4245
4346 return client . SendAsync (
Original file line number Diff line number Diff line change @@ -4,6 +4,6 @@ public interface IEventHubPublisher : IAsyncDisposable
44{
55 Task PublishAsync (
66 object message ,
7- IDictionary < string , string > messageProperties ,
7+ IDictionary < string , string > ? messageProperties = null ,
88 CancellationToken cancellationToken = default ) ;
99}
You can’t perform that action at this time.
0 commit comments