当前位置: 首页>>代码示例>>Java>>正文


Java Channel.basicCancel方法代码示例

本文整理汇总了Java中com.rabbitmq.client.Channel.basicCancel方法的典型用法代码示例。如果您正苦于以下问题:Java Channel.basicCancel方法的具体用法?Java Channel.basicCancel怎么用?Java Channel.basicCancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.rabbitmq.client.Channel的用法示例。


在下文中一共展示了Channel.basicCancel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: close

import com.rabbitmq.client.Channel; //导入方法依赖的package包/类
private void close(Connection connection, Channel channel) {
    try {
        if (channel != null && channel.isOpen()) {
            if (this.consumerTag != null) {
                channel.basicCancel(this.consumerTag);
                this.consumerTag = null;
            }
            log.info("Closing RabbitMQ Channel - " + this.serverIP);
            channel.close();
            this.channel = null;
        }
        if (connection != null && connection.isOpen()) {
            log.info("Closing RabbitMQ Connection - " + this.serverIP);
            connection.close(CLOSE_CONNECTION_TIMEOUT);
            this.connection = null;
        }
    } catch (Exception e) {
        log.error("Failed to close RabbitMQ connections " + this.serverIP, e);
    }
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:21,代码来源:RabbitMQClient.java

示例2: unsubscribe

import com.rabbitmq.client.Channel; //导入方法依赖的package包/类
@Override
public void unsubscribe(final UUID subscriberId, final EventSubscriber subscriber) throws EventBusException {
    try {
        final String classname = subscriber.getClass().getName();
        final String queueName = UUID.nameUUIDFromBytes(classname.getBytes()).toString();
        final Ternary<String, Channel, EventSubscriber> queueDetails = s_subscribers.get(queueName);
        final Channel channel = queueDetails.second();
        channel.basicCancel(queueName);
        s_subscribers.remove(queueName, queueDetails);
    } catch (final IOException e) {
        throw new EventBusException("Failed to unsubscribe from event bus due to " + e.getMessage(), e);
    }
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:14,代码来源:RabbitMQEventBus.java


注:本文中的com.rabbitmq.client.Channel.basicCancel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。