Table of Contents

Class AmqpTcpEndpoint

Namespace
RabbitMQ.Client
Assembly
RabbitMQ.Client.dll

Represents a TCP-addressable AMQP peer: a host name and port number.

public class AmqpTcpEndpoint
Inheritance
AmqpTcpEndpoint
Inherited Members

Constructors

AmqpTcpEndpoint()

Construct an AmqpTcpEndpoint with "localhost" as the hostname, and using the default port.

public AmqpTcpEndpoint()

AmqpTcpEndpoint(string, int)

Creates a new instance of the AmqpTcpEndpoint.

public AmqpTcpEndpoint(string hostName, int portOrMinusOne = -1)

Parameters

hostName string

Hostname.

portOrMinusOne int

Port number. If the port number is -1, the default port number will be used.

AmqpTcpEndpoint(string, int, SslOption)

Creates a new instance of the AmqpTcpEndpoint.

public AmqpTcpEndpoint(string hostName, int portOrMinusOne, SslOption ssl)

Parameters

hostName string

Hostname.

portOrMinusOne int

Port number. If the port number is -1, the default port number will be used.

ssl SslOption

Ssl option.

AmqpTcpEndpoint(string, int, SslOption, uint)

Creates a new instance of the AmqpTcpEndpoint.

public AmqpTcpEndpoint(string hostName, int portOrMinusOne, SslOption ssl, uint maxMessageSize)

Parameters

hostName string

Hostname.

portOrMinusOne int

Port number. If the port number is -1, the default port number will be used.

ssl SslOption

Ssl option.

maxMessageSize uint

Maximum message size from RabbitMQ. 0 means "unlimited"

AmqpTcpEndpoint(Uri)

Creates a new instance of the AmqpTcpEndpoint with the given Uri.

public AmqpTcpEndpoint(Uri uri)

Parameters

uri Uri

Remarks

Please see the class overview documentation for information about the Uri format in use.

AmqpTcpEndpoint(Uri, SslOption)

Creates a new instance of the AmqpTcpEndpoint with the given Uri and ssl options.

public AmqpTcpEndpoint(Uri uri, SslOption ssl)

Parameters

uri Uri
ssl SslOption

Remarks

Please see the class overview documentation for information about the Uri format in use.

Fields

DefaultAmqpSslPort

Default Amqp ssl port.

public const int DefaultAmqpSslPort = 5671

Field Value

int

UseDefaultPort

Indicates that the default port for the protocol should be used.

public const int UseDefaultPort = -1

Field Value

int

Properties

AddressFamily

Used to force the address family of the endpoint. Use InterNetwork to force to IPv4. Use InterNetworkV6 to force to IPv6. Or use Unknown to attempt both IPv6 and IPv4.

public AddressFamily AddressFamily { get; set; }

Property Value

AddressFamily

HostName

Retrieve or set the hostname of this AmqpTcpEndpoint.

public string HostName { get; set; }

Property Value

string

MaxMessageSize

Get the maximum size for a message in bytes. The default value is 0 (unlimited)

public uint MaxMessageSize { get; }

Property Value

uint

Port

Retrieve or set the port number of this AmqpTcpEndpoint. A port number of -1 causes the default port number.

public int Port { get; set; }

Property Value

int

Protocol

Retrieve IProtocol of this AmqpTcpEndpoint.

public IProtocol Protocol { get; }

Property Value

IProtocol

Ssl

Retrieve the TLS options for this AmqpTcpEndpoint. If not set, null is returned.

public SslOption Ssl { get; set; }

Property Value

SslOption

Methods

Clone()

Clones the endpoint.

public object Clone()

Returns

object

A copy with the same hostname, port, and TLS settings

CloneWithHostname(string)

Clones the endpoint using the provided hostname.

public AmqpTcpEndpoint CloneWithHostname(string hostname)

Parameters

hostname string

Hostname to use

Returns

AmqpTcpEndpoint

A copy with the provided hostname and port/TLS settings of this endpoint

Equals(object)

Compares this instance by value (protocol, hostname, port) against another instance.

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

Implementation of hash code depending on protocol, hostname and port, to line up with the implementation of Equals(object).

public override int GetHashCode()

Returns

int

Parse(string)

Construct an instance from a protocol and an address in "hostname:port" format.

public static AmqpTcpEndpoint Parse(string address)

Parameters

address string

Returns

AmqpTcpEndpoint

Remarks

If the address string passed in contains ":", it is split into a hostname and a port-number part. Otherwise, the entire string is used as the hostname, and the port-number is set to -1 (meaning the default number for the protocol variant specified). Hostnames provided as IPv6 must appear in square brackets ([]).

ParseMultiple(string)

Splits the passed-in string on ",", and passes the substrings to Parse(string).

public static AmqpTcpEndpoint[] ParseMultiple(string addresses)

Parameters

addresses string

Returns

AmqpTcpEndpoint[]

Remarks

Accepts a string of the form "hostname:port, hostname:port, ...", where the ":port" pieces are optional, and returns a corresponding array of AmqpTcpEndpoints.

ToString()

Returns a URI-like string of the form amqp-PROTOCOL://HOSTNAME:PORTNUMBER.

public override string ToString()

Returns

string

Remarks

This method is intended mainly for debugging and logging use.