mq

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Copyright 2020 newtbig Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020 newtbig Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020 newtbig Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var NATS_REQUEST_TIMEOUT = 10

Functions

This section is empty.

Types

type NatsClient

type NatsClient struct {
	// contains filtered or unexported fields
}

func NewNatsClient

func NewNatsClient(app module.App) (*NatsClient, error)

func (*NatsClient) AddStream

func (nc *NatsClient) AddStream(stream string, subjects []string) *nats.StreamInfo

func (*NatsClient) CallBack

func (c *NatsClient) CallBack() chan *framepb.Msg

func (*NatsClient) CloseHandler

func (nc *NatsClient) CloseHandler(conn *nats.Conn)

func (*NatsClient) CreatNatsKeyValue

func (nc *NatsClient) CreatNatsKeyValue(bukName string, ttl time.Duration) (nats.KeyValue, error)

func (*NatsClient) CreatNatsQueueSubscription

func (nc *NatsClient) CreatNatsQueueSubscription(subj string, queue string) (*nats.Subscription, error)

func (*NatsClient) CreatNatsSubscription

func (nc *NatsClient) CreatNatsSubscription(subj string) (*nats.Subscription, error)

func (*NatsClient) CreatNatsSubscriptionPull

func (nc *NatsClient) CreatNatsSubscriptionPull(subj string, queue string) (*nats.Subscription, error)

func (*NatsClient) Done

func (nc *NatsClient) Done()

func (*NatsClient) GetNatsConn

func (nc *NatsClient) GetNatsConn() *nats.Conn

func (*NatsClient) GetNatsJs

func (nc *NatsClient) GetNatsJs() nats.JetStreamContext

func (*NatsClient) Init

func (nc *NatsClient) Init()

func (*NatsClient) InitStreamWithSubjects

func (nc *NatsClient) InitStreamWithSubjects()

func (*NatsClient) Publish

func (nc *NatsClient) Publish(subj string, data []byte) error

func (*NatsClient) PublishMsg

func (nc *NatsClient) PublishMsg(subj string, msg *framepb.Msg) error

func (*NatsClient) RequestMsg

func (nc *NatsClient) RequestMsg(subj string, msg *framepb.Msg) (*framepb.Msg, error)

func (*NatsClient) SendMsg

func (nc *NatsClient) SendMsg(subj string, msg *framepb.Msg) error

func (*NatsClient) StartPublishHandle

func (nc *NatsClient) StartPublishHandle() (err error)

func (*NatsClient) StartRequestHandle

func (nc *NatsClient) StartRequestHandle() error

type StreamMsg

type StreamMsg struct {
	Subj string
	Data []byte
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL