qpid.apache.org: qpid.apache.org/proton Index | Files

package proton

import "qpid.apache.org/proton"

Package proton wraps Proton-C, an event-driven, concurrent-unsafe AMQP 1.0 C library (package 'electron' is more "Go-like" and concurrent-safe)

This package requires the [proton-C library](http://qpid.apache.org/proton) to be installed.

Consult the C API documentation at http://qpid.apache.org/proton for more information about the types here. There is a 1-1 correspondence between C type pn_foo_t and Go type proton.Foo, and between C function

pn_foo_do_something(pn_foo_t*, ...)

and Go method

func (proton.Foo) DoSomething(...)

The proton.Engine type pumps data between a Go net.Conn and a proton event loop goroutine that feeds events to a proton.MessagingHandler, which you must implement. See the Engine documentation for more.

MessagingHandler defines an event handling interface that you can implement to react to AMQP protocol events. There is also a lower-level EventHandler, but MessagingHandler provides a simpler set of events and automates common tasks for you, for most applications it will be more convenient.

NOTE: Methods on most types defined in this package (Sessions, Links etc.) can *only* be called in the event handler goroutine of the relevant Connection/Engine, either by the HandleEvent method of a handler type or in a function injected into the goroutine via Inject() or InjectWait() Handlers and injected functions can set up channels to communicate with other goroutines. Note the Injecter associated with a handler available as part of the Event value passed to HandleEvent.

Separate Engine instances are independent, and can run concurrently.

The 'electron' package is built on the proton package but instead offers a concurrent-safe API that can use simple procedural loops rather than event handlers to express application logic. It is easier to use for most applications.

Internal implementation details - ignore.


Package Files

doc.go engine.go error.go handlers.go message.go uuid.go wrappers.go wrappers_gen.go


const (
    SLocalUninit  State = C.PN_LOCAL_UNINIT
    SLocalActive        = C.PN_LOCAL_ACTIVE
    SLocalClosed        = C.PN_LOCAL_CLOSED
    SRemoteUninit       = C.PN_REMOTE_UNINIT
    SRemoteActive       = C.PN_REMOTE_ACTIVE
    SRemoteClosed       = C.PN_REMOTE_CLOSED
const (
    Received uint64 = C.PN_RECEIVED
    Accepted        = C.PN_ACCEPTED
    Rejected        = C.PN_REJECTED
    Released        = C.PN_RELEASED
    Modified        = C.PN_MODIFIED

func CloseError Uses

func CloseError(e Endpoint, err error)

CloseError sets an error condition (if err != nil) on an endpoint and closes the endpoint if not already closed

func Decref Uses

func Decref(c CHandle)

Decref decreases the refcount of a proton value, freeing the underlying C struct if this is the last reference. Only call this if you previously called Incref() for this value.

func EndpointError Uses

func EndpointError(e Endpoint) error

EndpointError returns the remote error if there is one, the local error if not nil if there is no error.

func Incref Uses

func Incref(c CHandle)

Incref increases the refcount of a proton value, which prevents the underlying C struct being freed until you call Decref().

It can be useful to "pin" a proton value in memory while it is in use by goroutines other than the event loop goroutine. For example if you Incref() a Link, the underlying object is not freed when the link is closed, so means other goroutines can continue to safely use it as an index in a map or inject it into the event loop goroutine. There will of course be an error if you try to use a link after it is closed, but not a segmentation fault.

func PnError Uses

func PnError(e *C.pn_error_t) error

func SASLExtended Uses

func SASLExtended() bool

Do we support extended SASL negotiation? All implementations of Proton support ANONYMOUS and EXTERNAL on both client and server sides and PLAIN on the client side.

Extended SASL implememtations use an external library (Cyrus SASL) to support other mechanisms beyond these basic ones.

type CHandle Uses

type CHandle interface {
    // CPtr returns the unsafe C pointer, equivalent to a C void*.
    CPtr() unsafe.Pointer

CHandle holds an unsafe.Pointer to a proton C struct, the C type depends on the Go type implementing this interface. For low level, at-your-own-risk use only.

type Condition Uses

type Condition struct {
    // contains filtered or unexported fields

func (Condition) CPtr Uses

func (c Condition) CPtr() unsafe.Pointer

func (Condition) Clear Uses

func (c Condition) Clear()

func (Condition) Copy Uses

func (c Condition) Copy(src Condition) int

func (Condition) Description Uses

func (c Condition) Description() string

func (Condition) Error Uses

func (c Condition) Error() error

Error returns an instance of amqp.Error or nil.

func (Condition) Info Uses

func (c Condition) Info() Data

func (Condition) IsNil Uses

func (c Condition) IsNil() bool

func (Condition) IsRedirect Uses

func (c Condition) IsRedirect() bool

func (Condition) IsSet Uses

func (c Condition) IsSet() bool

func (Condition) Name Uses

func (c Condition) Name() string

func (Condition) RedirectHost Uses

func (c Condition) RedirectHost() string

func (Condition) RedirectPort Uses

func (c Condition) RedirectPort() int

func (Condition) SetDescription Uses

func (c Condition) SetDescription(description string) int

func (Condition) SetError Uses

func (c Condition) SetError(err error)

Set a Go error into a condition, converting to an amqp.Error using amqp.MakeError

func (Condition) SetName Uses

func (c Condition) SetName(name string) int

type Connection Uses

type Connection struct {
    // contains filtered or unexported fields

func (Connection) CPtr Uses

func (c Connection) CPtr() unsafe.Pointer

func (Connection) Close Uses

func (c Connection) Close()

func (Connection) Condition Uses

func (c Connection) Condition() Condition

func (Connection) Container Uses

func (c Connection) Container() string

func (Connection) DesiredCapabilities Uses

func (c Connection) DesiredCapabilities() Data

func (Connection) Error Uses

func (c Connection) Error() error

func (Connection) Free Uses

func (c Connection) Free()

func (Connection) Hostname Uses

func (c Connection) Hostname() string

func (Connection) IsNil Uses

func (c Connection) IsNil() bool

func (Connection) LinkHead Uses

func (c Connection) LinkHead(s State) Link
func (c Connection) Links(state State) (links []Link)

func (Connection) OfferedCapabilities Uses

func (c Connection) OfferedCapabilities() Data

func (Connection) Open Uses

func (c Connection) Open()

func (Connection) Properties Uses

func (c Connection) Properties() Data

func (Connection) Release Uses

func (c Connection) Release()

func (Connection) RemoteCondition Uses

func (c Connection) RemoteCondition() Condition

func (Connection) RemoteContainer Uses

func (c Connection) RemoteContainer() string

func (Connection) RemoteDesiredCapabilities Uses

func (c Connection) RemoteDesiredCapabilities() Data

func (Connection) RemoteHostname Uses

func (c Connection) RemoteHostname() string

func (Connection) RemoteOfferedCapabilities Uses

func (c Connection) RemoteOfferedCapabilities() Data

func (Connection) RemoteProperties Uses

func (c Connection) RemoteProperties() Data

func (Connection) Reset Uses

func (c Connection) Reset()

func (Connection) Session Uses

func (c Connection) Session() (Session, error)

func (Connection) SessionHead Uses

func (c Connection) SessionHead(s State) Session

func (Connection) Sessions Uses

func (c Connection) Sessions(state State) (sessions []Session)

func (Connection) SetContainer Uses

func (c Connection) SetContainer(container string)

func (Connection) SetHostname Uses

func (c Connection) SetHostname(hostname string)

func (Connection) SetPassword Uses

func (c Connection) SetPassword(password []byte)

SetPassword takes []byte not string because it is impossible to erase a string from memory reliably. Proton will not keep the password in memory longer than needed, the caller should overwrite their copy on return.

The password must not contain embedded nul characters, a trailing nul is ignored.

func (Connection) SetUser Uses

func (c Connection) SetUser(user string)

func (Connection) State Uses

func (c Connection) State() State

func (Connection) String Uses

func (c Connection) String() string

Unique (per process) string identifier for a connection, useful for debugging.

func (Connection) Transport Uses

func (c Connection) Transport() Transport

func (Connection) Type Uses

func (c Connection) Type() string

func (Connection) User Uses

func (c Connection) User() string

type Data Uses

type Data struct {
    // contains filtered or unexported fields

Data is an intermediate form of decoded AMQP data.

func (Data) CPtr Uses

func (d Data) CPtr() unsafe.Pointer

func (Data) Clear Uses

func (d Data) Clear()

func (Data) Empty Uses

func (d Data) Empty() bool

func (Data) Error Uses

func (d Data) Error() error

func (Data) Free Uses

func (d Data) Free()

func (Data) Marshal Uses

func (d Data) Marshal(v interface{}) error

Marshal the value v into d, see amqp.Marshal() for details

func (Data) Next Uses

func (d Data) Next()

func (Data) Rewind Uses

func (d Data) Rewind()

func (Data) String Uses

func (d Data) String() string

func (Data) Unmarshal Uses

func (d Data) Unmarshal(ptr interface{}) error

Unmarshal the value of d into value pointed at by ptr, see amqp.Unmarshal() for details

type Delivery Uses

type Delivery struct {
    // contains filtered or unexported fields

func (Delivery) Abort Uses

func (d Delivery) Abort()

func (Delivery) Aborted Uses

func (d Delivery) Aborted() bool

func (Delivery) Accept Uses

func (d Delivery) Accept()

Accept accepts and settles a delivery.

func (Delivery) Buffered Uses

func (d Delivery) Buffered() bool

func (Delivery) CPtr Uses

func (d Delivery) CPtr() unsafe.Pointer

func (Delivery) Clear Uses

func (d Delivery) Clear()

func (Delivery) Current Uses

func (d Delivery) Current() bool

func (Delivery) Dump Uses

func (d Delivery) Dump()

func (Delivery) HasMessage Uses

func (d Delivery) HasMessage() bool

HasMessage is true if all message data is available. Equivalent to !d.isNil && d.Readable() && !d.Partial()

func (Delivery) IsNil Uses

func (d Delivery) IsNil() bool
func (d Delivery) Link() Link

func (Delivery) Local Uses

func (d Delivery) Local() Disposition

func (Delivery) LocalState Uses

func (d Delivery) LocalState() uint64

func (Delivery) Message Uses

func (delivery Delivery) Message() (amqp.Message, error)

Message decodes the message contained in a delivery.

Must be called in the correct link context with this delivery as the current message, handling an MMessage event is always a safe context to call this function.

Will return an error if message is incomplete or not current.

func (Delivery) MessageBytes Uses

func (delivery Delivery) MessageBytes() ([]byte, error)

MessageBytes extracts the raw message bytes contained in a delivery.

Must be called in the correct link context with this delivery as the current message, handling an MMessage event is always a safe context to call this function.

Will return an error if message is incomplete or not current.

func (Delivery) Partial Uses

func (d Delivery) Partial() bool

func (Delivery) Pending Uses

func (d Delivery) Pending() uint

func (Delivery) Readable Uses

func (d Delivery) Readable() bool

func (Delivery) Reject Uses

func (d Delivery) Reject()

Reject rejects and settles a delivery

func (Delivery) Release Uses

func (d Delivery) Release(delivered bool)

Release releases and settles a delivery If delivered is true the delivery count for the message will be increased.

func (Delivery) Remote Uses

func (d Delivery) Remote() Disposition

func (Delivery) RemoteState Uses

func (d Delivery) RemoteState() uint64

func (Delivery) Settle Uses

func (d Delivery) Settle()

func (Delivery) SettleAs Uses

func (d Delivery) SettleAs(disposition uint64)

SettleAs is equivalent to d.Update(disposition); d.Settle()

func (Delivery) Settled Uses

func (d Delivery) Settled() bool

func (Delivery) Tag Uses

func (d Delivery) Tag() DeliveryTag

func (Delivery) Update Uses

func (d Delivery) Update(state uint64)

func (Delivery) Updated Uses

func (d Delivery) Updated() bool

func (Delivery) Writable Uses

func (d Delivery) Writable() bool

type DeliveryTag Uses

type DeliveryTag struct {
    // contains filtered or unexported fields

func (DeliveryTag) String Uses

func (t DeliveryTag) String() string

type Disposition Uses

type Disposition struct {
    // contains filtered or unexported fields

func (Disposition) Annotations Uses

func (d Disposition) Annotations() Data

func (Disposition) CPtr Uses

func (d Disposition) CPtr() unsafe.Pointer

func (Disposition) Condition Uses

func (d Disposition) Condition() Condition

func (Disposition) Data Uses

func (d Disposition) Data() Data

func (Disposition) IsFailed Uses

func (d Disposition) IsFailed() bool

func (Disposition) IsNil Uses

func (d Disposition) IsNil() bool

func (Disposition) IsUndeliverable Uses

func (d Disposition) IsUndeliverable() bool

func (Disposition) SectionNumber Uses

func (d Disposition) SectionNumber() uint16

func (Disposition) SectionOffset Uses

func (d Disposition) SectionOffset() uint64

func (Disposition) SetFailed Uses

func (d Disposition) SetFailed(failed bool)

func (Disposition) SetSectionNumber Uses

func (d Disposition) SetSectionNumber(section_number uint16)

func (Disposition) SetSectionOffset Uses

func (d Disposition) SetSectionOffset(section_offset uint64)

func (Disposition) SetUndeliverable Uses

func (d Disposition) SetUndeliverable(undeliverable bool)

func (Disposition) Type Uses

func (d Disposition) Type() uint64

type DistributionMode Uses

type DistributionMode C.pn_distribution_mode_t
const (
    DistModeUnspecified DistributionMode = C.PN_DIST_MODE_UNSPECIFIED
    DistModeCopy        DistributionMode = C.PN_DIST_MODE_COPY
    DistModeMove        DistributionMode = C.PN_DIST_MODE_MOVE

func (DistributionMode) String Uses

func (e DistributionMode) String() string

type Durability Uses

type Durability C.pn_durability_t
const (
    Nondurable    Durability = C.PN_NONDURABLE
    Configuration Durability = C.PN_CONFIGURATION
    Deliveries    Durability = C.PN_DELIVERIES

func (Durability) String Uses

func (e Durability) String() string

type Endpoint Uses

type Endpoint interface {
    // State is the open/closed state.
    State() State
    // Open an endpoint.
    // Close an endpoint.
    // Condition holds a local error condition.
    Condition() Condition
    // RemoteCondition holds a remote error condition.
    RemoteCondition() Condition
    // Human readable name
    String() string
    // Human readable endpoint type "sender-link", "session" etc.
    Type() string

Endpoint is the common interface for Connection, Link and Session.

type Engine Uses

type Engine struct {
    // contains filtered or unexported fields

Engine reads from a net.Conn, decodes AMQP events and calls the appropriate Handler functions sequentially in a single goroutine. Actions taken by Handler functions (such as sending messages) are encoded and written to the net.Conn. You can create multiple Engines to handle multiple connections concurrently.

You implement the EventHandler and/or MessagingHandler interfaces and provide those values to NewEngine(). Their HandleEvent method will be called in the event-handling goroutine.

Handlers can pass values from an event (Connections, Links, Deliveries etc.) to other goroutines, store them, or use them as map indexes. Effectively they are just pointers. Other goroutines cannot call their methods directly but they can can create a function closure to call such methods and pass it to Engine.Inject() to have it evaluated in the engine goroutine.

You are responsible for ensuring you don't use an event value after it is invalid. The handler methods will tell you when a value is no longer valid. For example after a LinkClosed event, that link is no longer valid. If you do Link.Close() yourself (in a handler or injected function) the link remains valid until the corresponding LinkClosed event is received by the handler.

Engine.Close() will take care of cleaning up any remaining values when you are done with the Engine. All values associated with a engine become invalid when you call Engine.Close()

The qpid.apache.org/proton/concurrent package will do all this for you, so it may be a better choice for some applications.

func NewEngine Uses

func NewEngine(conn net.Conn, handlers ...EventHandler) (*Engine, error)

Create a new Engine and call Initialize() with conn and handlers

func (*Engine) Close Uses

func (eng *Engine) Close(err error)

Close the engine's connection. If err != nil pass it to the remote end as the close condition. Returns when the remote end closes or disconnects.

func (*Engine) CloseTimeout Uses

func (eng *Engine) CloseTimeout(err error, timeout time.Duration)

CloseTimeout like Close but disconnect if the remote end doesn't close within timeout.

func (*Engine) Connection Uses

func (eng *Engine) Connection() Connection

func (*Engine) Disconnect Uses

func (eng *Engine) Disconnect(err error)

Disconnect the engine's connection immediately without an AMQP close. Process any termination events before returning.

func (*Engine) Error Uses

func (eng *Engine) Error() error

func (*Engine) Id Uses

func (eng *Engine) Id() string

func (*Engine) Initialize Uses

func (eng *Engine) Initialize(conn net.Conn, handlers ...EventHandler) error

Initialize an Engine with a connection and handlers. Start it with Run()

func (*Engine) Inject Uses

func (eng *Engine) Inject(f func()) error

Inject a function into the Engine's event loop.

f() will be called in the same event-processing goroutine that calls Handler methods. f() can safely call methods on values that belong to this engine (Sessions, Links etc)

The injected function has no parameters or return values. It is normally a closure and can use channels to communicate with the injecting goroutine if necessary.

Returns a non-nil error if the engine is closed before the function could be injected.

func (*Engine) InjectWait Uses

func (eng *Engine) InjectWait(f func() error) error

InjectWait is like Inject but does not return till f() has completed or the engine is closed, and returns an error value from f()

func (*Engine) Run Uses

func (eng *Engine) Run() error

Run the engine. Engine.Run() will exit when the engine is closed or disconnected. You can check for errors after exit with Engine.Error().

func (*Engine) Server Uses

func (eng *Engine) Server()

Server puts the Engine in server mode, meaning it will auto-detect security settings on the incoming connection such as use of SASL and SSL. Must be called before Run()

func (*Engine) String Uses

func (eng *Engine) String() string

func (*Engine) Transport Uses

func (eng *Engine) Transport() Transport

type ErrorHolder Uses

type ErrorHolder struct {
    // contains filtered or unexported fields

ErrorHolder is a goroutine-safe error holder that keeps the first error that is set.

func (*ErrorHolder) Get Uses

func (e *ErrorHolder) Get() (err error)

Get the error.

func (*ErrorHolder) Set Uses

func (e *ErrorHolder) Set(err error)

Set the error if not already set

type Event Uses

type Event struct {
    // contains filtered or unexported fields

Event is an AMQP protocol event.

func (Event) Connection Uses

func (e Event) Connection() Connection

func (Event) Delivery Uses

func (e Event) Delivery() Delivery

func (Event) Injecter Uses

func (e Event) Injecter() Injecter

Injecter should not be used in a handler function, but it can be passed to other goroutines (via a channel or to a goroutine started by handler functions) to let them inject functions back into the handlers goroutine.

func (Event) IsNil Uses

func (e Event) IsNil() bool
func (e Event) Link() Link

func (Event) Session Uses

func (e Event) Session() Session

func (Event) String Uses

func (e Event) String() string

func (Event) Transport Uses

func (e Event) Transport() Transport

func (Event) Type Uses

func (e Event) Type() EventType

type EventHandler Uses

type EventHandler interface {
    // HandleEvent is called with an event.
    // Typically HandleEvent() is implemented as a switch on e.Type()
    HandleEvent(e Event)

EventHandler handles core proton events.

type EventType Uses

type EventType int
const (
    EConnectionInit         EventType = C.PN_CONNECTION_INIT
    EConnectionBound        EventType = C.PN_CONNECTION_BOUND
    EConnectionUnbound      EventType = C.PN_CONNECTION_UNBOUND
    EConnectionLocalOpen    EventType = C.PN_CONNECTION_LOCAL_OPEN
    EConnectionRemoteOpen   EventType = C.PN_CONNECTION_REMOTE_OPEN
    EConnectionLocalClose   EventType = C.PN_CONNECTION_LOCAL_CLOSE
    EConnectionRemoteClose  EventType = C.PN_CONNECTION_REMOTE_CLOSE
    EConnectionFinal        EventType = C.PN_CONNECTION_FINAL
    ESessionInit            EventType = C.PN_SESSION_INIT
    ESessionLocalOpen       EventType = C.PN_SESSION_LOCAL_OPEN
    ESessionRemoteOpen      EventType = C.PN_SESSION_REMOTE_OPEN
    ESessionLocalClose      EventType = C.PN_SESSION_LOCAL_CLOSE
    ESessionRemoteClose     EventType = C.PN_SESSION_REMOTE_CLOSE
    ESessionFinal           EventType = C.PN_SESSION_FINAL
    ELinkInit               EventType = C.PN_LINK_INIT
    ELinkLocalOpen          EventType = C.PN_LINK_LOCAL_OPEN
    ELinkRemoteOpen         EventType = C.PN_LINK_REMOTE_OPEN
    ELinkLocalClose         EventType = C.PN_LINK_LOCAL_CLOSE
    ELinkRemoteClose        EventType = C.PN_LINK_REMOTE_CLOSE
    ELinkLocalDetach        EventType = C.PN_LINK_LOCAL_DETACH
    ELinkRemoteDetach       EventType = C.PN_LINK_REMOTE_DETACH
    ELinkFlow               EventType = C.PN_LINK_FLOW
    ELinkFinal              EventType = C.PN_LINK_FINAL
    EDelivery               EventType = C.PN_DELIVERY
    ETransport              EventType = C.PN_TRANSPORT
    ETransportAuthenticated EventType = C.PN_TRANSPORT_AUTHENTICATED
    ETransportError         EventType = C.PN_TRANSPORT_ERROR
    ETransportHeadClosed    EventType = C.PN_TRANSPORT_HEAD_CLOSED
    ETransportTailClosed    EventType = C.PN_TRANSPORT_TAIL_CLOSED
    ETransportClosed        EventType = C.PN_TRANSPORT_CLOSED
    EConnectionWake         EventType = C.PN_CONNECTION_WAKE
    EListenerAccept         EventType = C.PN_LISTENER_ACCEPT
    EListenerClose          EventType = C.PN_LISTENER_CLOSE
    EProactorInterrupt      EventType = C.PN_PROACTOR_INTERRUPT
    EProactorTimeout        EventType = C.PN_PROACTOR_TIMEOUT
    EProactorInactive       EventType = C.PN_PROACTOR_INACTIVE
    EListenerOpen           EventType = C.PN_LISTENER_OPEN

func (EventType) String Uses

func (e EventType) String() string

type ExpiryPolicy Uses

type ExpiryPolicy C.pn_expiry_policy_t
const (
    ExpireWithLink       ExpiryPolicy = C.PN_EXPIRE_WITH_LINK
    ExpireWithSession    ExpiryPolicy = C.PN_EXPIRE_WITH_SESSION
    ExpireWithConnection ExpiryPolicy = C.PN_EXPIRE_WITH_CONNECTION
    ExpireNever          ExpiryPolicy = C.PN_EXPIRE_NEVER

func (ExpiryPolicy) String Uses

func (e ExpiryPolicy) String() string

type Injecter Uses

type Injecter interface {
    // Inject a function into the engine goroutine.
    // f() will be called in the same goroutine as event handlers, so it can safely
    // use values belonging to event handlers without synchronization. f() should
    // not block, no further events or injected functions can be processed until
    // f() returns.
    // Returns a non-nil error if the function could not be injected and will
    // never be called. Otherwise the function will eventually be called.
    // Note that proton values (Link, Session, Connection etc.) that existed when
    // Inject(f) was called may have become invalid by the time f() is executed.
    // Handlers should handle keep track of Closed events to ensure proton values
    // are not used after they become invalid. One technique is to have map from
    // proton values to application values. Check that the map has the correct
    // proton/application value pair at the start of the injected function and
    // delete the value from the map when handling a Closed event.
    Inject(f func()) error

    // InjectWait is like Inject but does not return till f() has completed.
    // If f() cannot be injected it returns the error from Inject(), otherwise
    // it returns the error from f()
    InjectWait(f func() error) error

Injecter allows functions to be "injected" into the event-processing loop, to be called in the same goroutine as event handlers.

type Link struct {
    // contains filtered or unexported fields

func (Link) Advance Uses

func (l Link) Advance() bool

func (Link) Available Uses

func (l Link) Available() int

func (Link) CPtr Uses

func (l Link) CPtr() unsafe.Pointer

func (Link) Close Uses

func (l Link) Close()

func (Link) Condition Uses

func (l Link) Condition() Condition

func (Link) Connection Uses

func (l Link) Connection() Connection

func (Link) Credit Uses

func (l Link) Credit() int

func (Link) Current Uses

func (l Link) Current() Delivery

func (Link) Delivery Uses

func (l Link) Delivery(tag string) Delivery

func (Link) Detach Uses

func (l Link) Detach()

func (Link) Drain Uses

func (l Link) Drain(credit int)

func (Link) Drained Uses

func (l Link) Drained() int

func (Link) Draining Uses

func (l Link) Draining() bool

func (Link) Error Uses

func (l Link) Error() error

func (Link) Flow Uses

func (l Link) Flow(credit int)

func (Link) Free Uses

func (l Link) Free()

func (Link) IsDrain Uses

func (l Link) IsDrain() bool

IsDrain calls pn_link_get_drain(), it conflicts with pn_link_drain() under the normal mapping.

func (Link) IsNil Uses

func (l Link) IsNil() bool

func (Link) IsReceiver Uses

func (l Link) IsReceiver() bool

func (Link) IsSender Uses

func (l Link) IsSender() bool

func (Link) MaxMessageSize Uses

func (l Link) MaxMessageSize() uint64

func (Link) Name Uses

func (l Link) Name() string

func (Link) Next Uses

func (l Link) Next(state State) Link

func (Link) Offered Uses

func (l Link) Offered(credit int)

func (Link) Open Uses

func (l Link) Open()

func (Link) Queued Uses

func (l Link) Queued() int

func (Link) RcvSettleMode Uses

func (l Link) RcvSettleMode() RcvSettleMode

func (Link) Recv Uses

func (l Link) Recv(buf []byte) int

func (Link) RemoteCondition Uses

func (l Link) RemoteCondition() Condition

func (Link) RemoteCredit Uses

func (l Link) RemoteCredit() int

func (Link) RemoteMaxMessageSize Uses

func (l Link) RemoteMaxMessageSize() uint64

func (Link) RemoteRcvSettleMode Uses

func (l Link) RemoteRcvSettleMode() RcvSettleMode

func (Link) RemoteSndSettleMode Uses

func (l Link) RemoteSndSettleMode() SndSettleMode

func (Link) RemoteSource Uses

func (l Link) RemoteSource() Terminus

func (Link) RemoteTarget Uses

func (l Link) RemoteTarget() Terminus

func (Link) Send Uses

func (link Link) Send(m amqp.Message) (Delivery, error)

Send sends a amqp.Message over a Link. Returns a Delivery that can be use to determine the outcome of the message.

func (Link) SendBytes Uses

func (l Link) SendBytes(bytes []byte) int

func (Link) SendMessageBytes Uses

func (link Link) SendMessageBytes(bytes []byte) (Delivery, error)

SendMessageBytes sends encoded bytes of an amqp.Message over a Link. Returns a Delivery that can be use to determine the outcome of the message.

func (Link) Session Uses

func (l Link) Session() Session

func (Link) SetDrain Uses

func (l Link) SetDrain(drain bool)

func (Link) SetMaxMessageSize Uses

func (l Link) SetMaxMessageSize(size uint64)

func (Link) SetRcvSettleMode Uses

func (l Link) SetRcvSettleMode(mode RcvSettleMode)

func (Link) SetSndSettleMode Uses

func (l Link) SetSndSettleMode(mode SndSettleMode)

func (Link) SndSettleMode Uses

func (l Link) SndSettleMode() SndSettleMode

func (Link) Source Uses

func (l Link) Source() Terminus

func (Link) State Uses

func (l Link) State() State

func (Link) String Uses

func (l Link) String() string

Human-readable link description including name, source, target and direction.

func (Link) Target Uses

func (l Link) Target() Terminus

func (Link) Type Uses

func (l Link) Type() string

func (Link) Unsettled Uses

func (l Link) Unsettled() int

type MessagingAdapter Uses

type MessagingAdapter struct {

    // AutoSettle (default true) automatically pre-settle outgoing messages.
    AutoSettle bool
    // AutoAccept (default true) automatically accept and settle incoming messages
    // if they are not settled by the delegate.
    AutoAccept bool
    // AutoOpen (default true) automatically open remotely opened endpoints.
    AutoOpen bool
    // Prefetch (default 10) initial credit to issue for incoming links.
    Prefetch int
    // PeerCloseIsError (default false) if true a close by the peer will be treated as an error.
    PeerCloseError bool
    // contains filtered or unexported fields

MessagingAdapter implements a EventHandler and delegates to a MessagingHandler. You can modify the exported fields before you pass the MessagingAdapter to a Engine.

func NewMessagingAdapter Uses

func NewMessagingAdapter(h MessagingHandler) *MessagingAdapter

func (*MessagingAdapter) HandleEvent Uses

func (d *MessagingAdapter) HandleEvent(e Event)

Handle a proton event by passing the corresponding MessagingEvent(s) to the MessagingHandler.

type MessagingEvent Uses

type MessagingEvent int

MessagingEvent provides a set of events that are easier to work with than the core events defined by EventType

There are 3 types of "endpoint": Connection, Session and Link. For each endpoint there are 5 events: Opening, Opened, Closing, Closed and Error.

The meaning of these events is as follows:

Opening: The remote end opened, the local end will open automatically.

Opened: Both ends are open, regardless of which end opened first.

Closing: The remote end closed without error, the local end will close automatically.

Error: The remote end closed with an error, the local end will close automatically.

Closed: Both ends are closed, regardless of which end closed first or if there was an error. No further events will be received for the endpoint.

const (
    // The event loop starts.
    MStart MessagingEvent = iota
    // The peer closes the connection with an error condition.
    // The peer closes the session with an error condition.
    // The peer closes the link with an error condition.
    // The peer Initiates the opening of the connection.
    // The peer initiates the opening of the session.
    // The peer initiates the opening of the link.
    // The connection is opened.
    // The session is opened.
    // The link is opened.
    // The peer initiates the closing of the connection.
    // The peer initiates the closing of the session.
    // The peer initiates the closing of the link.
    // Both ends of the connection are closed.
    // Both ends of the session are closed.
    // Both ends of the link are closed.
    // The sender link has credit and messages can
    // therefore be transferred.
    // The remote peer accepts an outgoing message.
    // The remote peer rejects an outgoing message.
    // The peer releases an outgoing message. Note that this may be in response to
    // either the RELEASE or MODIFIED state as defined by the AMQP specification.
    // The peer has settled the outgoing message. This is the point at which it
    // should never be re-transmitted.
    // A message is received. Call Event.Delivery().Message() to decode as an amqp.Message.
    // To manage the outcome of this messages (e.g. to accept or reject the message)
    // use Event.Delivery().
    // A network connection was disconnected.

func (MessagingEvent) String Uses

func (t MessagingEvent) String() string

type MessagingHandler Uses

type MessagingHandler interface {
    // HandleMessagingEvent is called with  MessagingEvent.
    // Typically HandleEvent() is implemented as a switch on e.Type()
    HandleMessagingEvent(MessagingEvent, Event)

MessagingHandler provides an alternative interface to EventHandler. it is easier to use for most applications that send and receive messages.

Implement this interface and then wrap your value with a MessagingHandlerDelegator. MessagingHandlerDelegator implements EventHandler and can be registered with a Engine.

type PnErrorCode Uses

type PnErrorCode int

func (PnErrorCode) String Uses

func (e PnErrorCode) String() string

type RcvSettleMode Uses

type RcvSettleMode C.pn_rcv_settle_mode_t
const (
    RcvFirst  RcvSettleMode = C.PN_RCV_FIRST
    RcvSecond RcvSettleMode = C.PN_RCV_SECOND

func (RcvSettleMode) String Uses

func (e RcvSettleMode) String() string

type SASL Uses

type SASL struct {
    // contains filtered or unexported fields

func (SASL) AllowInsecureMechs Uses

func (s SASL) AllowInsecureMechs() bool

func (SASL) AllowedMechs Uses

func (s SASL) AllowedMechs(mechs string)

func (SASL) CPtr Uses

func (s SASL) CPtr() unsafe.Pointer

func (SASL) ConfigName Uses

func (s SASL) ConfigName(name string)

func (SASL) ConfigPath Uses

func (s SASL) ConfigPath(path string)

func (SASL) Done Uses

func (s SASL) Done(outcome SASLOutcome)

func (SASL) IsNil Uses

func (s SASL) IsNil() bool

func (SASL) Mech Uses

func (s SASL) Mech() string

func (SASL) Outcome Uses

func (s SASL) Outcome() SASLOutcome

func (SASL) SetAllowInsecureMechs Uses

func (s SASL) SetAllowInsecureMechs(insecure bool)

func (SASL) User Uses

func (s SASL) User() string

type SASLOutcome Uses

type SASLOutcome C.pn_sasl_outcome_t
const (
    SASLOk   SASLOutcome = C.PN_SASL_OK
    SASLSys  SASLOutcome = C.PN_SASL_SYS

func (SASLOutcome) String Uses

func (e SASLOutcome) String() string

type Session Uses

type Session struct {
    // contains filtered or unexported fields

func (Session) CPtr Uses

func (s Session) CPtr() unsafe.Pointer

func (Session) Close Uses

func (s Session) Close()

func (Session) Condition Uses

func (s Session) Condition() Condition

func (Session) Connection Uses

func (s Session) Connection() Connection

func (Session) Error Uses

func (s Session) Error() error

func (Session) Free Uses

func (s Session) Free()

func (Session) IncomingBytes Uses

func (s Session) IncomingBytes() uint

func (Session) IncomingCapacity Uses

func (s Session) IncomingCapacity() uint

func (Session) IsNil Uses

func (s Session) IsNil() bool

func (Session) Next Uses

func (s Session) Next(state State) Session

func (Session) Open Uses

func (s Session) Open()

func (Session) OutgoingBytes Uses

func (s Session) OutgoingBytes() uint

func (Session) OutgoingWindow Uses

func (s Session) OutgoingWindow() uint

func (Session) Receiver Uses

func (s Session) Receiver(name string) Link

func (Session) RemoteCondition Uses

func (s Session) RemoteCondition() Condition

func (Session) Sender Uses

func (s Session) Sender(name string) Link

func (Session) SetIncomingCapacity Uses

func (s Session) SetIncomingCapacity(capacity uint)

func (Session) SetOutgoingWindow Uses

func (s Session) SetOutgoingWindow(window uint)

func (Session) State Uses

func (s Session) State() State

func (Session) String Uses

func (s Session) String() string

func (Session) Type Uses

func (s Session) Type() string

type SndSettleMode Uses

type SndSettleMode C.pn_snd_settle_mode_t
const (
    SndUnsettled SndSettleMode = C.PN_SND_UNSETTLED
    SndSettled   SndSettleMode = C.PN_SND_SETTLED
    SndMixed     SndSettleMode = C.PN_SND_MIXED

func (SndSettleMode) String Uses

func (e SndSettleMode) String() string

type State Uses

type State byte

State holds the state flags for an AMQP endpoint.

func (State) Has Uses

func (s State) Has(bits State) bool

Has is True if bits & state is non 0.

func (State) Local Uses

func (s State) Local() State

Return a State containing just the local flags

func (State) LocalActive Uses

func (s State) LocalActive() bool

func (State) LocalClosed Uses

func (s State) LocalClosed() bool

func (State) LocalUninit Uses

func (s State) LocalUninit() bool

func (State) Remote Uses

func (s State) Remote() State

Return a State containing just the remote flags

func (State) RemoteActive Uses

func (s State) RemoteActive() bool

func (State) RemoteClosed Uses

func (s State) RemoteClosed() bool

func (State) RemoteUninit Uses

func (s State) RemoteUninit() bool

type Terminus Uses

type Terminus struct {
    // contains filtered or unexported fields

func (Terminus) Address Uses

func (t Terminus) Address() string

func (Terminus) CPtr Uses

func (t Terminus) CPtr() unsafe.Pointer

func (Terminus) Capabilities Uses

func (t Terminus) Capabilities() Data

func (Terminus) Copy Uses

func (t Terminus) Copy(src Terminus) int

func (Terminus) Durability Uses

func (t Terminus) Durability() Durability

func (Terminus) ExpiryPolicy Uses

func (t Terminus) ExpiryPolicy() ExpiryPolicy

func (Terminus) Filter Uses

func (t Terminus) Filter() Data

func (Terminus) IsDynamic Uses

func (t Terminus) IsDynamic() bool

func (Terminus) IsNil Uses

func (t Terminus) IsNil() bool

func (Terminus) Outcomes Uses

func (t Terminus) Outcomes() Data

func (Terminus) Properties Uses

func (t Terminus) Properties() Data

func (Terminus) SetAddress Uses

func (t Terminus) SetAddress(address string) int

func (Terminus) SetDistributionMode Uses

func (t Terminus) SetDistributionMode(mode DistributionMode) int

func (Terminus) SetDurability Uses

func (t Terminus) SetDurability(durability Durability) int

func (Terminus) SetDynamic Uses

func (t Terminus) SetDynamic(dynamic bool) int

func (Terminus) SetExpiryPolicy Uses

func (t Terminus) SetExpiryPolicy(policy ExpiryPolicy) int

func (Terminus) SetTimeout Uses

func (t Terminus) SetTimeout(timeout time.Duration) int

func (Terminus) SetType Uses

func (t Terminus) SetType(type_ TerminusType) int

func (Terminus) Timeout Uses

func (t Terminus) Timeout() time.Duration

func (Terminus) Type Uses

func (t Terminus) Type() TerminusType

type TerminusType Uses

type TerminusType C.pn_terminus_type_t
const (
    Unspecified TerminusType = C.PN_UNSPECIFIED
    Source      TerminusType = C.PN_SOURCE
    Target      TerminusType = C.PN_TARGET
    Coordinator TerminusType = C.PN_COORDINATOR

func (TerminusType) String Uses

func (e TerminusType) String() string

type Transport Uses

type Transport struct {
    // contains filtered or unexported fields

func (Transport) Bind Uses

func (t Transport) Bind(connection Connection) int

func (Transport) CPtr Uses

func (t Transport) CPtr() unsafe.Pointer

func (Transport) Capacity Uses

func (t Transport) Capacity() int

func (Transport) ChannelMax Uses

func (t Transport) ChannelMax() uint32

func (Transport) CloseHead Uses

func (t Transport) CloseHead() int

func (Transport) CloseTail Uses

func (t Transport) CloseTail() int

func (Transport) Closed Uses

func (t Transport) Closed() bool

func (Transport) Condition Uses

func (t Transport) Condition() Condition

func (Transport) Connection Uses

func (t Transport) Connection() Connection

func (Transport) Error Uses

func (t Transport) Error() error

func (Transport) Free Uses

func (t Transport) Free()

func (Transport) Head Uses

func (t Transport) Head() unsafe.Pointer

Special treatment for Transport.Head, return value is unsafe.Pointer not string

func (Transport) IdleTimeout Uses

func (t Transport) IdleTimeout() time.Duration

func (Transport) Input Uses

func (t Transport) Input(bytes string, available uint) int

func (Transport) IsAuthenticated Uses

func (t Transport) IsAuthenticated() bool

func (Transport) IsEncrypted Uses

func (t Transport) IsEncrypted() bool

func (Transport) IsNil Uses

func (t Transport) IsNil() bool

func (Transport) Log Uses

func (t Transport) Log(message string)

func (Transport) MaxFrame Uses

func (t Transport) MaxFrame() uint16

func (Transport) Output Uses

func (t Transport) Output(bytes string, size uint) int

func (Transport) Peek Uses

func (t Transport) Peek(dst string, size uint) int

func (Transport) Pending Uses

func (t Transport) Pending() int

func (Transport) Pop Uses

func (t Transport) Pop(size uint)

func (Transport) Process Uses

func (t Transport) Process(size uint) int

func (Transport) Push Uses

func (t Transport) Push(bytes []byte) int

Special treatment for Transport.Push, takes []byte instead of char*, size

func (Transport) Quiesced Uses

func (t Transport) Quiesced() bool

func (Transport) RemoteChannelMax Uses

func (t Transport) RemoteChannelMax() uint32

func (Transport) RemoteIdleTimeout Uses

func (t Transport) RemoteIdleTimeout() time.Duration

func (Transport) RemoteMaxFrame Uses

func (t Transport) RemoteMaxFrame() uint16

func (Transport) RequireAuth Uses

func (t Transport) RequireAuth(required bool)

func (Transport) RequireEncryption Uses

func (t Transport) RequireEncryption(required bool)

func (Transport) SASL Uses

func (t Transport) SASL() SASL

Get the SASL object for the transport.

func (Transport) SetChannelMax Uses

func (t Transport) SetChannelMax(channel_max uint32) int

func (Transport) SetIdleTimeout Uses

func (t Transport) SetIdleTimeout(timeout time.Duration)

func (Transport) SetMaxFrame Uses

func (t Transport) SetMaxFrame(size uint16)

func (Transport) SetServer Uses

func (t Transport) SetServer()

func (Transport) String Uses

func (t Transport) String() string

func (Transport) Tail Uses

func (t Transport) Tail() unsafe.Pointer

Special treatment for Transport.Tail, return value is unsafe.Pointer not string

func (Transport) Tick Uses

func (t Transport) Tick(now int64) int64

func (Transport) Unbind Uses

func (t Transport) Unbind() int

func (Transport) User Uses

func (t Transport) User() string

type UUID Uses

type UUID [16]byte

UUID is a 16-byte Universally Unique Identifier

func UUID4 Uses

func UUID4() UUID

UUID4 returns a randomly-generated (version 4) UUID, as per RFC4122

func (UUID) String Uses

func (u UUID) String() string

String gives a UUID in standard string format.

Package proton imports 12 packages (graph) and is imported by 1 packages. Updated 2019-03-09. Refresh now. Tools for package owners.