client

package
v0.0.0-...-b12578f Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2018 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

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.

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.

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 apiied. See the License for the specific language governing permissions and limitations under the License.

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.

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.

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.

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.

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.

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.

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.

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.

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

This section is empty.

Functions

func RemoveMQClient

func RemoveMQClient(clientId string)

RemoveMQClient 删除客户端

Types

type Callback

type Callback = common.Callback

type Config

type Config struct {
	NameSrvAddrs                  []string
	InstanceName                  string
	ClientIP                      string
	ClientCallbackExecutorThreads int
	PullNameServerInteval         int
	HeartbeatBrokerInterval       int
	PersistConsumerOffsetInterval int
}

func (*Config) BuildClientId

func (cfg *Config) BuildClientId() string

BuildClientId

func (*Config) ChangeInstanceNameToPID

func (cfg *Config) ChangeInstanceNameToPID()

type MQClient

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

func GetAndCreateMQClient

func GetAndCreateMQClient(cfg *Config) *MQClient

GetAndCreateMQClient 查询MQClient,无则创建一个

func NewMQClient

func NewMQClient(cfg Config, index int32, clientId string) *MQClient

NewMQClient 初始化

func (*MQClient) ConsumeMessageDirectly

func (mqClient *MQClient) ConsumeMessageDirectly(msg *message.MessageExt,
	consumerGroup, brokerName string) *head.ConsumeMessageDirectlyResult

func (*MQClient) FindBrokerAddressInPublish

func (mqClient *MQClient) FindBrokerAddressInPublish(brokerName string) string

查找broker的master地址

func (*MQClient) RegisterConsumer

func (mqClient *MQClient) RegisterConsumer(group string, consumer consumerInner) bool

RegisterConsumer 将生产者group和发送类保存到内存中

func (*MQClient) RegisterProducer

func (mqClient *MQClient) RegisterProducer(group string, producer producerInner) bool

RegisterProducer 将生产者group和发送类保存到内存中

func (*MQClient) SendHeartbeatToAllBrokerWithLock

func (mqClient *MQClient) SendHeartbeatToAllBrokerWithLock() error

向所有boker发送心跳

func (*MQClient) SendMessage

func (mqClient *MQClient) SendMessage(addr string, brokerName string, msg *message.Message, header head.SendMessageRequestHeader,
	timeout int64, commMode common.CommunicationMode, callback Callback) (*Result, error)

func (*MQClient) SetDefaultProduer

func (mqClient *MQClient) SetDefaultProduer(producer producerOuter)

func (*MQClient) Shutdown

func (mqClient *MQClient) Shutdown()

Shutdown

func (*MQClient) Start

func (mqClient *MQClient) Start()

Start

func (*MQClient) UnRegisterConsumer

func (mqClient *MQClient) UnRegisterConsumer(group string)

UnRegisterConsumer 注销消费者

func (*MQClient) UnRegisterProducer

func (mqClient *MQClient) UnRegisterProducer(group string)

UnRegisterProducer 注销生产者

func (*MQClient) UpdateTopicRouteInfoFromNameServer

func (mqClient *MQClient) UpdateTopicRouteInfoFromNameServer()

从nameserver更新路由信息

func (*MQClient) UpdateTopicRouteInfoFromNameServerByArgs

func (mqClient *MQClient) UpdateTopicRouteInfoFromNameServerByArgs(topic string, isDefault bool, producer producerOuter) bool

func (*MQClient) UpdateTopicRouteInfoFromNameServerByTopic

func (mqClient *MQClient) UpdateTopicRouteInfoFromNameServerByTopic(topic string) bool

type ProcessQueue

type ProcessQueue struct {
	Dropped           bool
	LastPullTimestamp int64
	PullMaxIdleTime   int64
	MsgCount          int64
	QueueOffsetMax    int64
	Consuming         bool
	MsgAccCnt         int64
	// contains filtered or unexported fields
}

func NewProcessQueue

func NewProcessQueue() *ProcessQueue

func (*ProcessQueue) GetMaxSpan

func (pq *ProcessQueue) GetMaxSpan() int64

func (*ProcessQueue) IsPullExpired

func (pq *ProcessQueue) IsPullExpired() bool

func (*ProcessQueue) PutMessage

func (pq *ProcessQueue) PutMessage(msgs []*message.MessageExt) bool

func (*ProcessQueue) RemoveMessage

func (pq *ProcessQueue) RemoveMessage(msgs []*message.MessageExt) int64

func (*ProcessQueue) String

func (pq *ProcessQueue) String() string

type PullCallback

type PullCallback interface {
	OnSuccess(pullResultExt *PullResultExt)
}

type PullRequest

type PullRequest struct {
	ConsumerGroup string
	NextOffset    int64
	// contains filtered or unexported fields
}

type PullResultExt

type PullResultExt struct {
	*common.PullResult
	// contains filtered or unexported fields
}

type Result

type Result = common.Result

type TopicPublishInfo

type TopicPublishInfo struct {
	Order               bool
	HaveTopicRouterInfo bool
	MessageQueues       []*message.MessageQueue
	SendWhichQueue      int64
}

func (*TopicPublishInfo) SelectOneMessageQueue

func (info *TopicPublishInfo) SelectOneMessageQueue(lastBrokerName string) *message.MessageQueue

取模获取选择队列

func (*TopicPublishInfo) String

func (info *TopicPublishInfo) String() string

Jump to

Keyboard shortcuts

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