# Class: Policy

## Policy

#### new Policy(overrides)

The default policy for amqp10 clients

##### Parameters:

Name | Type | Description
--- | --- | ---
`overrides` | object | override values for the default policy

### Members

#### connect :object

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`options` | object | Options passed into the open performative on initial connection ###### Properties
Name | Type | Description
--- | --- | ---
`containerId` | string | function | The id of the source container
`hostname` | string | The name of the target host
`maxFrameSize` | number | The largest frame size that the sending peer is able to accept on this connection
`channelMax` | number | The channel-max value is the highest channel number that can be used on the connection
`idleTimeout` | number | The idle timeout required by the sender
`outgoingLocales` | array.<string> | null | A list of the locales that the peer supports for sending informational text
`incomingLocales` | array.<string> | null | A list of locales that the sending peer permits for incoming informational text
`offeredCapabilities` | array.<string> | null | A list of extension capabilities the peer may use if the sender offers them
`desiredCapabilities` | array | null | The desired-capability list defines which extension capabilities the sender may use if the receiver offers them
`properties` | object | null | The properties map contains a set of fields intended to indicate information about the connection and its container
`sslOptions` | object | Options used to initiate a TLS/SSL connection, with the exception of the following options all options in this object are passed directly to node's tls.connect method. ###### Properties
Name | Type | Description
--- | --- | ---
`keyFile` | string | null | Path to the file containing the private key for the client
`certFile` | string | null | Path to the file containing the certificate key for the client
`caFile` | string | null | Path to the file containing the trusted cert for the client
`rejectUnauthorized` | boolean |
`saslMechanism` | string | null | Allows the sasl mechanism to be overriden by policy

#### defaultSubjects

support subjects in link names with the following characteristics:
receiver: "amq.topic/news", means a filter on the ReceiverLink will be made
for messages send with a subject "news"

sender: "amq.topic/news", will automatically set "news" as the subject for
messages sent on this link, unless the user explicitly overrides
the subject.

##### Properties:

Type | Description
--- | ---
boolean |

#### receiverLink :object

##### Type:

- object

##### Properties:

Name | Type | Default | Description
--- | --- | --- | ---
`attach` | object |  | Options passed into the `attach` performative on link attachment ###### Properties
Name | Type | Description
--- | --- | ---
`name` | string | function | This name uniquely identifies the link from the container of the source to the container of the target node
`role` | boolean | The role being played by the peer
`receiverSettleMode` | number | string | The delivery settlement policy for the receiver
`maxMessageSize` | number | The maximum message size supported by the link endpoint
`initialDeliveryCount` | number | This must not be null if role is sender, and it is ignored if the role is receiver.
`credit` | function |  | A function that determines when (if ever) to refresh the receiver link's credit
`creditQuantum` | number |  | Quantum used in pre-defined credit policy functions
`decoder` | function | null | null | The optional decoder used for all incoming data
`reattach` | boolean | null | null | Whether the link should attempt reattach on detach

#### reconnect :Object|null

Options related to the reconnect behavior of the client. If this value is `null` reconnect
is effectively disabled

##### Type:

- Object | null

##### Properties:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`retries` | number | null | <optional> |  | How many times to attempt reconnection
`strategy` | string | <optional> | 'fibonacci' | The algorithm used for backoff. Can be `fibonacci` or `exponential`
`forever` | boolean | <optional> |  | Whether or not to attempt reconnection forever

#### senderLink :object

##### Type:

- object

##### Properties:

Name | Type | Default | Description
--- | --- | --- | ---
`attach` | object |  | Options passed into the `attach` performative on link attachment ###### Properties
Name | Type | Description
--- | --- | ---
`name` | string | function | This name uniquely identifies the link from the container of the source to the container of the target node
`role` | string | boolean | The role being played by the peer
`senderSettleMode` | string | number | The delivery settlement policy for the sender
`maxMessageSize` | number | The maximum message size supported by the link endpoint
`initialDeliveryCount` | number | This must not be null if role is sender, and it is ignored if the role is receiver.
`callback` | string |  | Determines when a send should call its callback ('settle', 'sent', 'none')
`encoder` | function | null | null | The optional encoder used for all outgoing sends
`reattach` | boolean | null | null | Whether the link should attempt reattach on detach

#### session :object

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`options` | object | Options passed into the `begin` performative on session start ###### Properties
Name | Type | Description
--- | --- | ---
`nextOutgoingId` | number | The transfer-id to assign to the next transfer frame
`incomingWindow` | number | The maximum number of incoming transfer frames that the endpoint can currently receive
`outgoingWindow` | number | The maximum number of outgoing transfer frames that the endpoint can currently send
`window` | function | A function used to calculate how/when the flow control window should change
`windowQuantum` | number | Quantum used in predefined window policies
`enableSessionFlowControl` | boolean | Whether or not session flow control should be performed at all

### Methods

#### parseAddress(address) → {object}

Parses an address for use when connecting to an AMQP 1.0 broker

##### Parameters:

Name | Type | Description
--- | --- | ---
`address` | string | the address to parse

##### Returns:

Type
  object

#### parseLinkAddress(address) → {object}

Parses a link address used for creating Sender and Receiver links.

The resulting object has a required `name` property (used as the source
address in the attach performative), as well as an optional `subject` property
which (if specified) will automatically create a source filter.

##### Parameters:

Name | Type | Description
--- | --- | ---
`address` | string | the address to parse

##### Returns:

Type
  object