Examples of MessageAck


Examples of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.MessageAck

   
    /**
     * @return a new object instance
     */
    public DataStructure createObject() {
        return new MessageAck();
    }
View Full Code Here

Examples of org.activemq.message.MessageAck

                                store.replayAddMessage(msg);
                                transactionCounter++;
                            }
                        }
                        else if (packet instanceof MessageAck) {
                            MessageAck ack = (MessageAck) packet;
                            JournalMessageStore store = (JournalMessageStore) createMessageStore(destination, ack.getDestination().isQueue());
                            if( ack.getTransactionId()!=null ) {
                                transactionStore.removeMessage(store, ack, pos);
                            } else {
                                store.replayRemoveMessage(ack);
                                transactionCounter++;
                            }
                        }
                        else {
                            log.error("Unknown type of packet in transaction log which will be discarded: " + packet);
                        }

                        break;
                    case TX_COMMAND_RECORD_TYPE:
                       
                        TxCommand command = new TxCommand();
                        command.setType(is.readByte());
                        command.setWasPrepared(is.readBoolean());
                        switch(command.getType()) {
                          case TxCommand.LOCAL_COMMIT:
                          case TxCommand.LOCAL_ROLLBACK:
                              command.setTransactionId(is.readUTF());
                              break;
                          default:
                              command.setTransactionId(ActiveMQXid.read(is));
                            break;
                        }
                       
                        // Try to replay the packet.
                        switch(command.getType()) {
                          case TxCommand.XA_PREPARE:
                              transactionStore.replayPrepare(command.getTransactionId());
                              break;
                          case TxCommand.XA_COMMIT:
                          case TxCommand.LOCAL_COMMIT:
                              Tx tx = transactionStore.replayCommit(command.getTransactionId(), command.getWasPrepared());
                              // Replay the committed operations.
                              if( tx!=null) {
                                  tx.getOperations();
                                  for (Iterator iter = tx.getOperations().iterator(); iter.hasNext();) {
                                      TxOperation op = (TxOperation) iter.next();
                                      if( op.operationType == TxOperation.ADD_OPERATION_TYPE ) {
                                          op.store.replayAddMessage((ActiveMQMessage) op.data);
                                      }
                                      if( op.operationType == TxOperation.REMOVE_OPERATION_TYPE) {
                                          op.store.replayRemoveMessage((MessageAck) op.data);
                                      }
                                      if( op.operationType == TxOperation.ACK_OPERATION_TYPE) {
                                          JournalAck ack = (JournalAck) op.data;
                                          ((JournalTopicMessageStore)op.store).replayAcknowledge(ack.getSubscription(), new MessageIdentity(ack.getMessageId()));
                                      }
                                  }
                                  transactionCounter++;
                              }
                              break;
View Full Code Here

Examples of org.apache.activemq.apollo.openwire.command.MessageAck

   
    /**
     * @return a new object instance
     */
    public DataStructure createObject() {
        return new MessageAck();
    }
View Full Code Here

Examples of org.apache.activemq.command.MessageAck

        // dispatch thread is ready to flush the dispatch list
        clearDispatchList = true;
    }

    void deliverAcks() {
        MessageAck ack = null;
        if (deliveryingAcknowledgements.compareAndSet(false, true)) {
            if (this.optimizeAcknowledge) {
                if (!deliveredMessages.isEmpty()) {
                    MessageDispatch md = deliveredMessages.getFirst();
                    ack = new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, deliveredMessages.size());
                    deliveredMessages.clear();
                    ackCounter = 0;
                }
            }
            if (ack != null) {
                final MessageAck ackToSend = ack;
                if (executorService == null) {
                    executorService = Executors.newSingleThreadExecutor();
                }
                executorService.submit(new Runnable() {
                    public void run() {
View Full Code Here

Examples of org.apache.activemq.command.MessageAck

                if (!deliveredMessages.isEmpty()) {
                    if (optimizeAcknowledge) {
                        if (deliveryingAcknowledgements.compareAndSet(false, true)) {
                            ackCounter++;
                            if (ackCounter >= (info.getCurrentPrefetchSize() * .65)) {
                                MessageAck ack = new MessageAck(md, MessageAck.STANDARD_ACK_TYPE,
                                                                deliveredMessages.size());
                                session.asyncSendPacket(ack);
                                ackCounter = 0;
                                deliveredMessages.clear();
                            }
                            deliveryingAcknowledgements.set(false);
                        }
                    } else {
                        MessageAck ack = new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, deliveredMessages
                            .size());
                        session.asyncSendPacket(ack);
                        deliveredMessages.clear();
                    }
                }
View Full Code Here

Examples of org.apache.activemq.command.MessageAck

        // The delivered message list is only needed for the recover method
        // which is only used with client ack.
        deliveredCounter++;
        if ((0.5 * info.getPrefetchSize()) <= (deliveredCounter - additionalWindowSize)) {
            MessageAck ack = new MessageAck(md, ackType, deliveredCounter);
            ack.setTransactionId(session.getTransactionContext().getTransactionId());
            session.asyncSendPacket(ack);
            additionalWindowSize = deliveredCounter;

            // When using DUPS ok, we do a real ack.
            if (ackType == MessageAck.STANDARD_ACK_TYPE) {
View Full Code Here

Examples of org.apache.activemq.command.MessageAck

            return;
        }

        // Acknowledge the last message.
        MessageDispatch lastMd = deliveredMessages.get(0);
        MessageAck ack = new MessageAck(lastMd, MessageAck.STANDARD_ACK_TYPE, deliveredMessages.size());
        if (session.isTransacted()) {
            session.doStartTransaction();
            ack.setTransactionId(session.getTransactionContext().getTransactionId());
        }
        session.asyncSendPacket(ack);

        // Adjust the counters
        deliveredCounter -= deliveredMessages.size();
View Full Code Here

Examples of org.apache.activemq.command.MessageAck

                && lastMd.getMessage().getRedeliveryCounter() > redeliveryPolicy.getMaximumRedeliveries()) {
                // We need to NACK the messages so that they get sent to the
                // DLQ.
                // Acknowledge the last message.
               
                MessageAck ack = new MessageAck(lastMd, MessageAck.POSION_ACK_TYPE, deliveredMessages.size());
                session.asyncSendPacket(ack);
                // ensure we don't filter this as a duplicate
                session.connection.rollbackDuplicate(this, lastMd.getMessage());
                // Adjust the window size.
                additionalWindowSize = Math.max(0, additionalWindowSize - deliveredMessages.size());
                redeliveryDelay = 0;
            } else {
               
                MessageAck ack = new MessageAck(lastMd, MessageAck.REDELIVERED_ACK_TYPE, deliveredMessages.size());
                session.asyncSendPacket(ack);

                // stop the delivery of messages.
                unconsumedMessages.stop();
View Full Code Here

Examples of org.apache.activemq.command.MessageAck

            }
        };
    }

    protected void removeMessage(ConnectionContext c, IndirectMessageReference r) throws IOException {
        MessageAck ack = new MessageAck();
        ack.setAckType(MessageAck.STANDARD_ACK_TYPE);
        ack.setDestination(destination);
        ack.setMessageID(r.getMessageId());
        acknowledge(c, null, ack, r);
        r.drop();
        dropEvent();
    }
View Full Code Here

Examples of org.apache.activemq.command.MessageAck

                    waitStarted();
                    MessageDispatch md = (MessageDispatch)command;
                    serviceRemoteConsumerAdvisory(md.getMessage().getDataStructure());
                    demandConsumerDispatched++;
                    if (demandConsumerDispatched > (demandConsumerInfo.getPrefetchSize() * .75)) {
                        remoteBroker.oneway(new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, demandConsumerDispatched));
                        demandConsumerDispatched = 0;
                    }
                } else if (command.isBrokerInfo()) {
                    lastConnectSucceeded.set(true);
                    remoteBrokerInfo = (BrokerInfo)command;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.