vertx / io.vertx.ext.stomp / StompClientConnection / subscribe

# subscribe

`abstract fun subscribe(destination: String, handler: Handler<Frame>): String`

Subscribes to the given destination. This destination is used as subscription id.

### Parameters

`destination` - the destination, must not be `null`

`handler` - the handler invoked when a message is received on the given destination. Must not be `null`.

Return
the subscription id.

`abstract fun subscribe(destination: String, handler: Handler<Frame>, receiptHandler: Handler<Frame>): String`

Subscribes to the given destination. This destination is used as subscription id.

### Parameters

`destination` - the destination, must not be `null`

`handler` - the handler invoked when a message is received on the given destination. Must not be `null`.

`receiptHandler` - the handler invoked when the `RECEIPT` frame associated with the subscription has been received. The handler receives the sent frame (`SUBSCRIBE`).

Return
the subscription id.

`abstract fun subscribe(destination: String, headers: MutableMap<String, String>, handler: Handler<Frame>): String`

Subscribes to the given destination.

### Parameters

`destination` - the destination, must not be `null`.

`headers` - the headers to configure the subscription. It may contain the `ack` header to configure the acknowledgment policy. If the given set of headers contains the `id` header, this value is used as subscription id.

`handler` - the handler invoked when a message is received on the given destination. Must not be `null`.

Return
the subscription id, which can either be the destination or the id set in the headers.

`abstract fun subscribe(destination: String, headers: MutableMap<String, String>, handler: Handler<Frame>, receiptHandler: Handler<Frame>): String`

Subscribes to the given destination.

### Parameters

`destination` - the destination, must not be `null`

`headers` - the headers to configure the subscription. It may contain the `ack` header to configure the acknowledgment policy. If the given set of headers contains the `id` header, this value is used as subscription id.

`handler` - the handler invoked when a message is received on the given destination. Must not be `null`.

`receiptHandler` - the handler invoked when the `RECEIPT` frame associated with the subscription has been received. The handler receives the sent frame (`SUBSCRIBE`).

Return
the subscription id, which can either be the destination or the id set in the headers.