You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Look! I stole Josh's stuff...publicclassAmqpMessageBody:TransportMessageBody{publicReadOnlyMemory<byte>Data{get;set;}publicIEnumerable<IList<object>>Sequence{get;set;}publicobjectValue{get;set;}// Not in love with the name, other ideas for a way to create?publicServiceBusMessageCreateServiceBusMessage()=>newServiceBusMessage{TransportBody=this,TransportFormat=TransportMessageFormat.Amqp};internaloverrideReadOnlyMemory<byte>GetBinaryData()=>Data;// This may be a bad idea; I'm not sure how I feel about it.publicstaticexplicitoperatorServiceBusMessage(AmqpMessageBodybody)=>body.CreateServiceBusMessage();}// ... and I stole Yanni's idea!publicstaticclassServiceBusMessageExtensions{publicstaticAmqpMessageBodyGetAmqpBody(thisServiceBusMessageinstance)=>(AmqpMessageBody)instance.TransportBody;publicstaticvoidSetAmqpBody(thisServiceBusMessageinstance,AmqpMessageBodybody){// Argument.AssertNotNull(body);instance.TransportBody=body;instance.TransportFormat=TransportMessageFormat.Amqp;}}
Azure.Messaging.SerivceBus.Transport
// Only exists to allow the Service Bus Message to query a transport body for a binary representation// to use for the `Body` property. Not sure how I feel about this...publicabstractclassTransportMessageBody{internalabstractReadOnlyMemory<byte>GetBinaryData();}
Azure.Messaging.ServiceBus.Core
// Used to denote that a Service Bus Message has a transport-specific body applied;// intended to be used by the message converter to ensure it can translate.internalenumTransportMessageFormat{Amqp}
Azure.Messaging.ServiceBus
// Only showing new or updated members; there's a bunch of existing surface not shown.publicclassServiceBusMessage{privateReadOnlyMemory<byte>_body;internalTransportMessageBodyTransportBody{get;set;}// If this is `null` then no transport-specific body has been set.internalTransportMessageFormat?TransportFormat{get;set;}publicReadOnlyMemory<byte>Body{get{if(!_body.IsEmpty){return_body;}if(TransportFormat.HasValue){returnTransportBody.GetBinaryData();}returndefault;}set{if(TransportFormat.HasValue){thrownewInvalidOperationException("Transport-specific body has already been specified.");}_body=value;}}}