Receiving Messages from a Channel
Subscriptions come in several forms:
- Regular
- Durable
- Queue
- Queue/Durable
For more details on the various types, check the concepts section.
Subscriptions set their starting position on creation using position or time. For example, in Go you can start at:
- The last message received
func(m *stan.Msg) {...},
stan.DeliverAllAvailable())
- A specific message, indexing starts at 1
- A specific time the message arrived in the channel
...
sub, err := sc.Subscribe("foo",
stan.StartAtTime(startTime))
To set the delay after which the server should attempt to redeliver a message for which it has not received an acknowledgment:
To simply close:
err := sub.Close()
To unsubscribe: