C# 클래스 RabbitMQ.Client.ConnectionFactory

Main entry point to the RabbitMQ .NET AMQP client API. Constructs IConnection instances.

A simple example of connecting to a broker:

ConnectionFactory factory = new ConnectionFactory(); // // The next six lines are optional: factory.UserName = ConnectionFactory.DefaultUser; factory.Password = ConnectionFactory.DefaultPass; factory.VirtualHost = ConnectionFactory.DefaultVHost; factory.HostName = hostName; factory.Port = AmqpTcpEndpoint.UseDefaultPort; // IConnection conn = factory.CreateConnection(); // IModel ch = conn.CreateModel(); // // ... use ch's IModel methods ... // ch.Close(Constants.ReplySuccess, "Closing the channel"); conn.Close(Constants.ReplySuccess, "Closing the connection");

The same example, written more compactly with AMQP URIs:

ConnectionFactory factory = new ConnectionFactory(); factory.Uri = "amqp://localhost"; IConnection conn = factory.CreateConnection(); ...

Please see also the API overview and tutorial in the User Guide.

Note that the Uri property takes a string representation of an AMQP URI. Omitted URI parts will take default values. The host part of the URI cannot be omitted and URIs of the form "amqp://foo/" (note the trailling slash) also represent the default virtual host. The latter issue means that virtual hosts with an empty name are not addressable.

파일 보기 프로젝트 열기: rabbitmq/rabbitmq-dotnet-client 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
DefaultAuthMechanisms IList

프로퍼티 상세

DefaultAuthMechanisms 공개적으로 정적으로 프로퍼티

Default SASL auth mechanisms to use.
public static IList DefaultAuthMechanisms
리턴 IList