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


Java MessageProperties.BASIC属性代码示例

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


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

示例1: send

/****
 * This method is used to publish the message to RabbitMQ
 * @param routingKey
 * @param msg is Eiffel Event
 * @throws IOException
 */
public void send(String routingKey, String msg) throws IOException {

    Channel channel = giveMeRandomChannel();
    channel.addShutdownListener(new ShutdownListener() {
        public void shutdownCompleted(ShutdownSignalException cause) {
            // Beware that proper synchronization is needed here
            if (cause.isInitiatedByApplication()) {
                log.debug("Shutdown is initiated by application. Ignoring it.");
            } else {
                log.error("Shutdown is NOT initiated by application.");
                log.error(cause.getMessage());
                boolean cliMode = Boolean.getBoolean(PropertiesConfig.CLI_MODE);
                if (cliMode) {
                    System.exit(-3);
                }
            }
        }
    });

    BasicProperties msgProps = MessageProperties.BASIC;
    if (usePersitance)
        msgProps = MessageProperties.PERSISTENT_BASIC;

    channel.basicPublish(exchangeName, routingKey, msgProps, msg.getBytes());
    log.info("Published message with size {} bytes on exchange '{}' with routing key '{}'", msg.getBytes().length,
            exchangeName, routingKey);
}
 
开发者ID:Ericsson,项目名称:eiffel-remrem-publish,代码行数:33,代码来源:RabbitMqProperties.java

示例2: convert

private static AMQP.BasicProperties convert(String name) throws RuleException {
    switch (name) {
        case "BASIC":
            return MessageProperties.BASIC;
        case "TEXT_PLAIN":
            return MessageProperties.TEXT_PLAIN;
        case "MINIMAL_BASIC":
            return MessageProperties.MINIMAL_BASIC;
        case "MINIMAL_PERSISTENT_BASIC":
            return MessageProperties.MINIMAL_PERSISTENT_BASIC;
        case "PERSISTENT_BASIC":
            return MessageProperties.PERSISTENT_BASIC;
        case "PERSISTENT_TEXT_PLAIN":
            return MessageProperties.PERSISTENT_TEXT_PLAIN;
        default:
            throw new RuleException("Message Properties: '" + name + "' is undefined!");
    }
}
 
开发者ID:thingsboard,项目名称:thingsboard,代码行数:18,代码来源:RabbitMqMsgHandler.java

示例3: createProps

private AMQP.BasicProperties createProps(InternalMessage message) {
    if(message.getTimeout() < 0) {
        return message.isDurable() ? MessageProperties.PERSISTENT_BASIC : MessageProperties.BASIC;
    } else {
        if(message.isDurable()) {
            return new AMQP.BasicProperties.Builder().contentType("application/octet-stream").deliveryMode(2)
                    .priority(0).expiration(String.valueOf(message.getTimeout())).build();
        } else {
            return new AMQP.BasicProperties.Builder().contentType("application/octet-stream").deliveryMode(1)
                    .priority(0).expiration(String.valueOf(message.getTimeout())).build();
        }
    }
}
 
开发者ID:elasticsoftwarefoundation,项目名称:elasticactors,代码行数:13,代码来源:RemoteMessageQueue.java


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