static long GetSize(EventData eventData, bool first) { // Create AMQP message here. We will use the same message while sending to save compute time. eventData.AmqpMessage = AmqpMessageConverter.EventDataToAmqpMessage(eventData); return(eventData.AmqpMessage.SerializedMessageSize); }
long GetEventSizeForBatch(EventData eventData) { // Create AMQP message here. var amqpMessage = AmqpMessageConverter.EventDataToAmqpMessage(eventData); AmqpMessageConverter.UpdateAmqpMessagePartitionKey(amqpMessage, this.PartitionKey); // Calculate overhead depending on the message size. // Overhead is smaller for messages smaller than 256 bytes. long overhead = amqpMessage.SerializedMessageSize < 256 ? 5 : 8; // We can use the same AMQP message unless diagnostics is enabled. // Diagnostics extension will stamp message with an id on the Send call. if (!EventHubsDiagnosticSource.IsEnabledForSendActivity) { eventData.AmqpMessage = amqpMessage; } else { // Reserve overhead for diagnostic-id property. overhead += DiagnosticsIdOverhead; } return(amqpMessage.SerializedMessageSize + overhead); }
long GetSize(EventData eventData) { // Create AMQP message here. We will use the same message while sending to save compute time. var amqpMessage = AmqpMessageConverter.EventDataToAmqpMessage(eventData); AmqpMessageConverter.UpdateAmqpMessagePartitionKey(amqpMessage, this.PartitionKey); eventData.AmqpMessage = amqpMessage; return(eventData.AmqpMessage.SerializedMessageSize); }
public void ContentTypeToAmqpMessage() { var eventData = new EventData(new byte[10]); eventData.ContentType = "this content type"; var message = AmqpMessageConverter.EventDataToAmqpMessage(eventData); Assert.Equal(message.Properties.ContentType.Value, eventData.ContentType); }
long GetEventSizeForBatch(EventData eventData) { // Create AMQP message here. We will use the same message while sending to save compute time. var amqpMessage = AmqpMessageConverter.EventDataToAmqpMessage(eventData); AmqpMessageConverter.UpdateAmqpMessagePartitionKey(amqpMessage, this.PartitionKey); eventData.AmqpMessage = amqpMessage; // Calculate overhead depending on the message size. // Overhead is smaller for messages smaller than 256 bytes. long overhead = eventData.AmqpMessage.SerializedMessageSize < 256 ? 5 : 8; return eventData.AmqpMessage.SerializedMessageSize + overhead; }