Azure服务总线 - 延迟队列消息java sdk

时间:2015-01-23 11:56:56

标签: java azure message-queue azureservicebus

我正在尝试在天蓝色服务总线队列中设置延迟消息 https://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.brokeredmessage.scheduledenqueuetimeutc.aspx

我有以下java代码

 ServiceBusContract serviceBus = ServiceBusService.create(ServiceBusConfiguration
            .configureWithWrapAuthentication(env.getSERVICEBUS_NS(), env.getSERVICEBUS_OWNER(),
                    env.getSERVICEBUS_KEY(), ".servicebus.windows.net",
                    "-sb.accesscontrol.windows.net/WRAPv0.9")) 
 BrokeredMessage brokeredMessage = new BrokeredMessage(inputStream);
 Calendar instance = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
 instance.add(Calendar.MINUTE, 1);
 brokeredMessage.setScheduledEnqueueTimeUtc(instance.getTime());
 serviceBus.sendQueueMessage("queueName", brokeredMessage);

我希望这条消息能在一分钟的延迟时间内排队,但它会立即出现。

我做错了什么?还有其他属性要设置吗?也许特殊的队列属性?感谢

0 个答案:

没有答案