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
    1. func(m *stan.Msg) {...},
    2. stan.DeliverAllAvailable())
    • A specific message, indexing starts at 1
    • A specific time the message arrived in the channel
    1. ...
    2. sub, err := sc.Subscribe("foo",
    3. 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:

    1. err := sub.Close()

    To unsubscribe: