Class AmqpTcpEndpoint
Represents a TCP-addressable AMQP peer: a host name and port number.
public class AmqpTcpEndpoint
- Inheritance
-
AmqpTcpEndpoint
- Inherited Members
Remarks
Some of the constructors take, as a convenience, a Uri instance representing an AMQP server address. The use of Uri here is not standardised - Uri is simply a convenient container for internet-address-like components. In particular, the Uri "Scheme" property is ignored: only the "Host" and "Port" properties are extracted.
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
stringHostname.
portOrMinusOne
intPort 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
stringHostname.
portOrMinusOne
intPort number. If the port number is -1, the default port number will be used.
ssl
SslOptionSsl option.
AmqpTcpEndpoint(string, int, SslOption, uint)
Creates a new instance of the AmqpTcpEndpoint.
public AmqpTcpEndpoint(string hostName, int portOrMinusOne, SslOption ssl, uint maxInboundMessageBodySize)
Parameters
hostName
stringHostname.
portOrMinusOne
intPort number. If the port number is -1, the default port number will be used.
ssl
SslOptionSsl option.
maxInboundMessageBodySize
uintMaximum message size from RabbitMQ.
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
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
UseDefaultPort
Indicates that the default port for the protocol should be used.
public const int UseDefaultPort = -1
Field Value
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
HostName
Retrieve or set the hostname of this AmqpTcpEndpoint.
public string HostName { get; set; }
Property Value
MaxInboundMessageBodySize
Get the maximum size for a message in bytes. The default value is defined in DefaultMaxInboundMessageBodySize.
public uint MaxInboundMessageBodySize { get; }
Property Value
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
Protocol
Retrieve IProtocol of this AmqpTcpEndpoint.
public IProtocol Protocol { get; }
Property Value
Ssl
Retrieve the TLS options for this AmqpTcpEndpoint. If not set, null is returned.
public SslOption Ssl { get; set; }
Property Value
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
stringHostname 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
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
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
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
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
Remarks
This method is intended mainly for debugging and logging use.