[rabbitmq-discuss] BasicPublish in .NET using client 2.8.1.0 and transaction support

Simon MacMullen simon at rabbitmq.com
Fri Jun 14 18:11:40 BST 2013


On 13/06/13 19:02, martywaz wrote:
> When calling BasicPublish in .NET c#, is it required to explicitly make
> a call to DtxStart and TxCommit to ensure that the message published is
> within a transaction?

TxStart, not DtxStart; RabbitMQ does not support DTX. But yes, that's 
how you publish in transactions.

Cheers, Simon

>
> for example, our psudo code for creating a connection is this:
>
>              var connectionFactory = new ConnectionFactory
>              {
>                  HostName = this.hostName,
>                  Password = this.password,
>                  Port = this.port != -1 ? this.port :
> AmqpTcpEndpoint.UseDefaultPort,
>                  UserName = this.userName,
>                  Protocol = Protocols.FromConfiguration()
>              };
>              this.connection = connectionFactory.CreateConnection();
>              this.connection.ConnectionShutdown +=
> this.ConnectionOnConnectionShutdown;
>              this.model = this.connection.CreateModel();
>
>              if (this.properties.Durable)
>              {
>                  this.model.ConfirmSelect();
>              }
>
>              this.model.BasicAcks += new
> BasicAckEventHandler(this.MessageAcknowledged);
>              this.model.BasicNacks += this.MessageNotAcknowledged;
>              this.model.BasicReturn += this.MessageReturned;
>              this.model.FlowControl += this.FlowControlChanged;
>              this.model.CallbackException += ReportCallbackException;
>
> and psudo publish code looks like this:
>
>                           this.model.BasicPublish(
>                          this.exchangeName,
>                          string.Empty,
>                          this.properties.Durable,
>                          this.properties.Immediate,
>                          messageProperties,
>                          body);
>
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>


-- 
Simon MacMullen
RabbitMQ, Pivotal


More information about the rabbitmq-discuss mailing list