本文整理汇总了Java中org.apache.activemq.command.ActiveMQMessage.onSend方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQMessage.onSend方法的具体用法?Java ActiveMQMessage.onSend怎么用?Java ActiveMQMessage.onSend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.command.ActiveMQMessage
的用法示例。
在下文中一共展示了ActiveMQMessage.onSend方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTransportError
import org.apache.activemq.command.ActiveMQMessage; //导入方法依赖的package包/类
public void onTransportError() {
if (connect != null) {
if (connected.get() && connect.willTopic() != null && connect.willMessage() != null) {
try {
PUBLISH publish = new PUBLISH();
publish.topicName(connect.willTopic());
publish.qos(connect.willQos());
publish.payload(connect.willMessage());
ActiveMQMessage message = convertMessage(publish);
message.setProducerId(producerId);
message.onSend();
sendToActiveMQ(message, null);
} catch (Exception e) {
LOG.warn("Failed to publish Will Message " + connect.willMessage());
}
}
}
}
示例2: onMQTTPublish
import org.apache.activemq.command.ActiveMQMessage; //导入方法依赖的package包/类
void onMQTTPublish(PUBLISH command) throws IOException, JMSException {
checkConnected();
ActiveMQMessage message = convertMessage(command);
message.setProducerId(producerId);
message.onSend();
sendToActiveMQ(message, createResponseHandler(command));
}
示例3: send
import org.apache.activemq.command.ActiveMQMessage; //导入方法依赖的package包/类
/**
* Internal send method optimized: - It does not copy the message - It can
* only handle ActiveMQ messages. - You can specify if the send is async or
* sync - Does not allow you to send /w a transaction.
*/
void send(ActiveMQDestination destination, ActiveMQMessage msg, MessageId messageId, int deliveryMode, int priority, long timeToLive, boolean async) throws JMSException {
checkClosedOrFailed();
if (destination.isTemporary() && isDeleted(destination)) {
throw new JMSException("Cannot publish to a deleted Destination: " + destination);
}
msg.setJMSDestination(destination);
msg.setJMSDeliveryMode(deliveryMode);
long expiration = 0L;
if (!isDisableTimeStampsByDefault()) {
long timeStamp = System.currentTimeMillis();
msg.setJMSTimestamp(timeStamp);
if (timeToLive > 0) {
expiration = timeToLive + timeStamp;
}
}
msg.setJMSExpiration(expiration);
msg.setJMSPriority(priority);
msg.setJMSRedelivered(false);
msg.setMessageId(messageId);
msg.onSend();
msg.setProducerId(msg.getMessageId().getProducerId());
if (LOG.isDebugEnabled()) {
LOG.debug("Sending message: " + msg);
}
if (async) {
asyncSendPacket(msg);
} else {
syncSendPacket(msg);
}
}
示例4: configure
import org.apache.activemq.command.ActiveMQMessage; //导入方法依赖的package包/类
protected void configure(ActiveMQMessage msg) throws JMSException {
long sequenceNumber = messageSequence.incrementAndGet();
msg.setMessageId(new MessageId(producerId, sequenceNumber));
msg.onSend();
msg.setProducerId(producerId);
}