Package org.apache.activemq.command

Examples of org.apache.activemq.command.Message


        MessageDispatchNotification mdn = new MessageDispatchNotification();
        mdn.setConsumerId(messageDispatch.getConsumerId());
        mdn.setDeliverySequenceId(messageDispatch.getDeliverySequenceId());
        mdn.setDestination(messageDispatch.getDestination());
        if (messageDispatch.getMessage() != null) {
            Message msg = messageDispatch.getMessage();
            mdn.setMessageId(msg.getMessageId());
            sendAsyncToSlave(mdn);
        }
        super.postProcessDispatch(messageDispatch);
    }
View Full Code Here


        ctx.setDestination(destination.getActiveMQDestination());
        BooleanExpression selectorExpression = selector == null ? null : new SelectorParser().parse(selector);

        for (int i = 0; i < messages.length; i++) {
            try {
                Message message = messages[i];
                if (selectorExpression == null) {
                    answer.add(OpenTypeSupport.convert(message));
                } else {
                    ctx.setMessageReference(message);
                    if (selectorExpression.matches(ctx)) {
View Full Code Here

        }
        return false;
    }

    public synchronized int getSize() {
        Message msg = message;
        if (msg != null) {
            return msg.getSize();
        }
        return cachedSize;
    }
View Full Code Here

    /**
     * @return the next pending message
     */
    public synchronized MessageReference next() {
        Message message = (Message)iter.next();
        last = message;
        if (!isDiskListEmpty()) {
            // got from disk
            message.setRegionDestination(regionDestination);
            message.setMemoryUsage(this.getSystemUsage().getMemoryUsage());
            message.incrementReferenceCount();
        }
        return message;
    }
View Full Code Here

        return false;
    }

    public synchronized void addMessageLast(MessageReference node) throws Exception {
        if (node != null) {
            Message msg = node.getMessage();
            if (started) {
                if (!msg.isPersistent()) {
                    nonPersistent.addMessageLast(node);
                }
            }
            if (msg.isPersistent()) {
                Destination dest = msg.getRegionDestination();
                TopicStorePrefetch tsp = topics.get(dest);
                if (tsp != null) {
                    tsp.addMessageLast(node);
                }
            }
View Full Code Here

    public QueueView(ManagedRegionBroker broker, Queue destination) {
        super(broker, destination);
    }

    public CompositeData getMessage(String messageId) throws OpenDataException {
        Message rc = ((Queue)destination).getMessage(messageId);
        if (rc == null) {
            return null;
        }
        return OpenTypeSupport.convert(rc);
    }
View Full Code Here

        result = brokerInfos.toArray(result);
        return result;
    }

    public void preProcessDispatch(MessageDispatch messageDispatch) {
        Message message = messageDispatch.getMessage();
        if (message != null) {
            long endTime = System.currentTimeMillis();
            message.setBrokerOutTime(endTime);
            if (getBrokerService().isEnableStatistics()) {
                long totalTime = endTime - message.getBrokerInTime();
                message.getRegionDestination().getDestinationStatistics().getProcessTime().addTime(totalTime);
            }
        }
    }
View Full Code Here

    public void sendToDeadLetterQueue(ConnectionContext context,
          MessageReference node){
    try{
      boolean sent=false;
      if(node!=null){
        Message message=node.getMessage();
        if(message!=null&&node.getRegionDestination()!=null){
          DeadLetterStrategy deadLetterStrategy=node
                  .getRegionDestination().getDeadLetterStrategy();
          if(deadLetterStrategy!=null){
            if(deadLetterStrategy.isSendToDeadLetterQueue(message)){
              long expiration=message.getExpiration();
              message.setExpiration(0);
              message.setProperty("originalExpiration",new Long(
                      expiration));
              if(!message.isPersistent()){
                message.setPersistent(true);
                message.setProperty("originalDeliveryMode",
                        "NON_PERSISTENT");
              }
              // The original destination and transaction id do
              // not get filled when the message is first
              // sent,
              // it is only populated if the message is routed to
              // another destination like the DLQ
              ActiveMQDestination deadLetterDestination=deadLetterStrategy
                      .getDeadLetterQueueFor(message
                              .getDestination());
              if (context.getBroker()==null) {
                context.setBroker(getRoot());
              }
              BrokerSupport.resend(context,message,
View Full Code Here

     * Assigns the message group to this subscription and set the flag on the
     * message that it is the first message to be dispatched.
     */
    protected void assignGroupToMe(MessageGroupMap messageGroupOwners, MessageReference n, String groupId) throws IOException {
        messageGroupOwners.put(groupId, info.getConsumerId());
        Message message = n.getMessage();
        if (message instanceof ActiveMQMessage) {
            ActiveMQMessage activeMessage = (ActiveMQMessage)message;
            try {
                activeMessage.setBooleanProperty("JMSXGroupFirstForConsumer", true, false);
            } catch (JMSException e) {
View Full Code Here

    protected DemandSubscription getDemandSubscription(MessageDispatch md) {
        return subscriptionMapByLocalId.get(md.getConsumerId());
    }

    protected Message configureMessage(MessageDispatch md) {
        Message message = md.getMessage().copy();
        // Update the packet to show where it came from.
        message.setBrokerPath(appendToBrokerPath(message.getBrokerPath(), localBrokerPath));
        message.setProducerId(producerInfo.getProducerId());
        message.setDestination(md.getDestination());
        if (message.getOriginalTransactionId() == null) {
            message.setOriginalTransactionId(message.getTransactionId());
        }
        message.setTransactionId(null);
        return message;
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.command.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.