@Override public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception { getNext().send(producerExchange, messageSend); }
/** Sets the persistence mode * @see org.apache.activemq.broker.BrokerFilter#send(org.apache.activemq.broker.ProducerBrokerExchange, org.apache.activemq.command.Message) */ public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception { messageSend.getMessage().setPersistent(isPersistent()); next.send(producerExchange, messageSend); }
@Override public Response processMessage(Message messageSend) throws Exception { ProducerId producerId = messageSend.getProducerId(); ProducerBrokerExchange producerExchange = getProducerBrokerExchange(producerId); if (producerExchange.canDispatch(messageSend)) { broker.send(producerExchange, messageSend); } return null; }
/** * */ public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception { ActiveMQDestination destination = message.getDestination(); if (destination.isComposite()) { ActiveMQDestination[] destinations = destination.getCompositeDestinations(); for (int i = 0; i < destinations.length; i++) { if (i != 0) { message = message.copy(); message.setMemoryUsage(null); } message.setOriginalDestination(destination); message.setDestination(destinations[i]); next.send(producerExchange, message); } } else { next.send(producerExchange, message); } }
private void doForward(ProducerBrokerExchange context, Message message, Broker regionBroker, ActiveMQDestination destination) throws Exception { Message forwardedMessage = message.copy(); forwardedMessage.setMemoryUsage(null); forwardedMessage.setOriginalDestination( message.getDestination() ); forwardedMessage.setDestination(destination); // Send it back through the region broker for routing. context.setMutable(true); regionBroker.send(context, forwardedMessage); } }
public void send(ProducerBrokerExchange producerExchange, final Message message) throws Exception { // This method may be invoked recursively. // Track original tx so that it can be restored. final ConnectionContext context = producerExchange.getConnectionContext(); Transaction originalTx = context.getTransaction(); Transaction transaction = null; if (message.getTransactionId() != null) { transaction = getTransaction(context, message.getTransactionId(), false); } context.setTransaction(transaction); try { next.send(producerExchange, message); } finally { context.setTransaction(originalTx); } }
private void scheduleRedelivery(ConnectionContext context, MessageReference messageReference, long delay, int redeliveryCount) throws Exception { if (LOG.isTraceEnabled()) { Destination regionDestination = (Destination) messageReference.getRegionDestination(); LOG.trace("redelivery #{} of: {} with delay: {}, dest: {}", new Object[]{ redeliveryCount, messageReference.getMessageId(), delay, regionDestination.getActiveMQDestination() }); } final Message old = messageReference.getMessage(); Message message = old.copy(); message.setTransactionId(null); message.setMemoryUsage(null); message.removeProperty(ScheduledMessage.AMQ_SCHEDULED_ID); message.setProperty(REDELIVERY_DELAY, delay); message.setProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay); message.setRedeliveryCounter(redeliveryCount); boolean originalFlowControl = context.isProducerFlowControl(); try { context.setProducerFlowControl(false); ProducerInfo info = new ProducerInfo(); ProducerState state = new ProducerState(info); ProducerBrokerExchange producerExchange = new ProducerBrokerExchange(); producerExchange.setProducerState(state); producerExchange.setMutable(true); producerExchange.setConnectionContext(context); context.getBroker().send(producerExchange, message); } finally { context.setProducerFlowControl(originalFlowControl); } }
protected void sendStats(ConnectionContext context, ActiveMQMapMessage msg, ActiveMQDestination replyTo) throws Exception { msg.setPersistent(false); msg.setTimestamp(System.currentTimeMillis()); msg.setPriority((byte) javax.jms.Message.DEFAULT_PRIORITY); msg.setType(AdvisorySupport.ADIVSORY_MESSAGE_TYPE); msg.setMessageId(new MessageId(this.advisoryProducerId, this.messageIdGenerator.getNextSequenceId())); msg.setDestination(replyTo); msg.setResponseRequired(false); msg.setProducerId(this.advisoryProducerId); boolean originalFlowControl = context.isProducerFlowControl(); final ProducerBrokerExchange producerExchange = new ProducerBrokerExchange(); producerExchange.setConnectionContext(context); producerExchange.setMutable(true); producerExchange.setProducerState(new ProducerState(new ProducerInfo())); try { context.setProducerFlowControl(false); this.next.send(producerExchange, msg); } finally { context.setProducerFlowControl(originalFlowControl); } }
try { context.setProducerFlowControl(false); this.next.send(producerExchange, msg); } finally { context.setProducerFlowControl(originalFlowControl);
public static void doResend(final ConnectionContext context, Message originalMessage, ActiveMQDestination deadLetterDestination, boolean copy) throws Exception { Message message = copy ? originalMessage.copy() : originalMessage; message.setOriginalDestination(message.getDestination()); message.setOriginalTransactionId(message.getTransactionId()); message.setDestination(deadLetterDestination); message.setTransactionId(null); message.setMemoryUsage(null); message.setRedeliveryCounter(0); message.getMessageId().setDataLocator(null); boolean originalFlowControl = context.isProducerFlowControl(); try { context.setProducerFlowControl(false); ProducerInfo info = new ProducerInfo(); ProducerState state = new ProducerState(info); ProducerBrokerExchange producerExchange = new ProducerBrokerExchange(); producerExchange.setProducerState(state); producerExchange.setMutable(true); producerExchange.setConnectionContext(context); context.getBroker().send(producerExchange, message); } finally { context.setProducerFlowControl(originalFlowControl); } }
try { context.setProducerFlowControl(false); next.send(producerExchange, advisoryMessage); } finally { context.setProducerFlowControl(originalFlowControl);
producerExchange.setConnectionContext(context); producerExchange.setProducerState(new ProducerState(new ProducerInfo())); context.getBroker().send(producerExchange, message); } finally { context.setProducerFlowControl(originalFlowControl);
/** Sets the persistence mode * @see org.apache.activemq.broker.BrokerFilter#send(org.apache.activemq.broker.ProducerBrokerExchange, org.apache.activemq.command.Message) */ public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception { messageSend.getMessage().setPersistent(isPersistent()); next.send(producerExchange, messageSend); }
/** Sets the persistence mode * @see org.apache.activemq.broker.BrokerFilter#send(org.apache.activemq.broker.ProducerBrokerExchange, org.apache.activemq.command.Message) */ public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception { messageSend.getMessage().setPersistent(isPersistent()); next.send(producerExchange, messageSend); }
@Override public Response processMessage(Message messageSend) throws Exception { ProducerId producerId = messageSend.getProducerId(); ProducerBrokerExchange producerExchange = getProducerBrokerExchange(producerId); if (producerExchange.canDispatch(messageSend)) { broker.send(producerExchange, messageSend); } return null; }
private void doForward(ProducerBrokerExchange context, Message message, Broker regionBroker, ActiveMQDestination destination) throws Exception { Message forwardedMessage = message.copy(); forwardedMessage.setMemoryUsage(null); forwardedMessage.setOriginalDestination( message.getDestination() ); forwardedMessage.setDestination(destination); // Send it back through the region broker for routing. context.setMutable(true); regionBroker.send(context, forwardedMessage); } }
private void doForward(ProducerBrokerExchange context, Message message, Broker regionBroker, ActiveMQDestination destination) throws Exception { Message forwardedMessage = message.copy(); forwardedMessage.setMemoryUsage(null); forwardedMessage.setOriginalDestination( message.getDestination() ); forwardedMessage.setDestination(destination); // Send it back through the region broker for routing. context.setMutable(true); regionBroker.send(context, forwardedMessage); } }