protected void onStompCommit(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); if (stompTx == null) { throw new ProtocolException("Must specify the transaction you are committing"); } TransactionId activemqTx = transactions.remove(stompTx); if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); } for (Iterator<StompSubscription> iter = subscriptionsByConsumerId.values().iterator(); iter.hasNext();) { StompSubscription sub = iter.next(); sub.onStompCommit(activemqTx); } TransactionInfo tx = new TransactionInfo(); tx.setConnectionId(connectionId); tx.setTransactionId(activemqTx); tx.setType(TransactionInfo.COMMIT_ONE_PHASE); sendToActiveMQ(tx, createResponseHandler(command)); }
protected void onStompDisconnect(StompFrame command) throws ProtocolException { checkConnected(); sendToActiveMQ(connectionInfo.createRemoveCommand(), createResponseHandler(command)); sendToActiveMQ(new ShutdownInfo(), createResponseHandler(command)); connected.set(false); }
protected void onStompAck(StompFrame command) throws ProtocolException { checkConnected();
protected void onStompCommit(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); if (stompTx == null) { throw new ProtocolException("Must specify the transaction you are committing"); } TransactionId activemqTx = transactions.remove(stompTx); if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); } for (StompSubscription sub : subscriptionsByConsumerId.values()) { sub.onStompCommit(activemqTx); } pedingAcks.clear(); TransactionInfo tx = new TransactionInfo(); tx.setConnectionId(connectionId); tx.setTransactionId(activemqTx); tx.setType(TransactionInfo.COMMIT_ONE_PHASE); sendToActiveMQ(tx, createResponseHandler(command)); }
protected void onStompAbort(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); if (stompTx == null) { throw new ProtocolException("Must specify the transaction you are committing"); } TransactionId activemqTx = transactions.remove(stompTx); if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); } for (Iterator<StompSubscription> iter = subscriptionsByConsumerId.values().iterator(); iter.hasNext();) { StompSubscription sub = iter.next(); try { sub.onStompAbort(activemqTx); } catch (Exception e) { throw new ProtocolException("Transaction abort failed", false, e); } } TransactionInfo tx = new TransactionInfo(); tx.setConnectionId(connectionId); tx.setTransactionId(activemqTx); tx.setType(TransactionInfo.ROLLBACK); sendToActiveMQ(tx, createResponseHandler(command)); }
protected void onStompCommit(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); if (stompTx == null) { throw new ProtocolException("Must specify the transaction you are committing"); } TransactionId activemqTx = transactions.remove(stompTx); if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); } for (StompSubscription sub : subscriptionsByConsumerId.values()) { sub.onStompCommit(activemqTx); } pedingAcks.clear(); TransactionInfo tx = new TransactionInfo(); tx.setConnectionId(connectionId); tx.setTransactionId(activemqTx); tx.setType(TransactionInfo.COMMIT_ONE_PHASE); sendToActiveMQ(tx, createResponseHandler(command)); }
protected void onStompBegin(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); if (!headers.containsKey(Stomp.Headers.TRANSACTION)) { throw new ProtocolException("Must specify the transaction you are beginning"); } if (transactions.get(stompTx) != null) { throw new ProtocolException("The transaction was already started: " + stompTx); } LocalTransactionId activemqTx = new LocalTransactionId(connectionId, transactionIdGenerator.getNextSequenceId()); transactions.put(stompTx, activemqTx); TransactionInfo tx = new TransactionInfo(); tx.setConnectionId(connectionId); tx.setTransactionId(activemqTx); tx.setType(TransactionInfo.BEGIN); sendToActiveMQ(tx, createResponseHandler(command)); }
protected void onStompBegin(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); if (!headers.containsKey(Stomp.Headers.TRANSACTION)) { throw new ProtocolException("Must specify the transaction you are beginning"); } if (transactions.get(stompTx) != null) { throw new ProtocolException("The transaction was already started: " + stompTx); } LocalTransactionId activemqTx = new LocalTransactionId(connectionId, transactionIdGenerator.getNextSequenceId()); transactions.put(stompTx, activemqTx); TransactionInfo tx = new TransactionInfo(); tx.setConnectionId(connectionId); tx.setTransactionId(activemqTx); tx.setType(TransactionInfo.BEGIN); sendToActiveMQ(tx, createResponseHandler(command)); }
protected void onStompCommit(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); if (stompTx == null) { throw new ProtocolException("Must specify the transaction you are committing"); } TransactionId activemqTx = transactions.remove(stompTx); if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); } for (StompSubscription sub : subscriptionsByConsumerId.values()) { sub.onStompCommit(activemqTx); } pedingAcks.clear(); TransactionInfo tx = new TransactionInfo(); tx.setConnectionId(connectionId); tx.setTransactionId(activemqTx); tx.setType(TransactionInfo.COMMIT_ONE_PHASE); sendToActiveMQ(tx, createResponseHandler(command)); }
protected void onStompBegin(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); if (!headers.containsKey(Stomp.Headers.TRANSACTION)) { throw new ProtocolException("Must specify the transaction you are beginning"); } if (transactions.get(stompTx) != null) { throw new ProtocolException("The transaction was already started: " + stompTx); } LocalTransactionId activemqTx = new LocalTransactionId(connectionId, transactionIdGenerator.getNextSequenceId()); transactions.put(stompTx, activemqTx); TransactionInfo tx = new TransactionInfo(); tx.setConnectionId(connectionId); tx.setTransactionId(activemqTx); tx.setType(TransactionInfo.BEGIN); sendToActiveMQ(tx, createResponseHandler(command)); }
protected void onStompBegin(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); if (!headers.containsKey(Stomp.Headers.TRANSACTION)) { throw new ProtocolException("Must specify the transaction you are beginning"); } if (transactions.get(stompTx) != null) { throw new ProtocolException("The transaction was allready started: " + stompTx); } LocalTransactionId activemqTx = new LocalTransactionId(connectionId, transactionIdGenerator.getNextSequenceId()); transactions.put(stompTx, activemqTx); TransactionInfo tx = new TransactionInfo(); tx.setConnectionId(connectionId); tx.setTransactionId(activemqTx); tx.setType(TransactionInfo.BEGIN); sendToActiveMQ(tx, createResponseHandler(command)); }
protected void onStompAbort(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); if (stompTx == null) { throw new ProtocolException("Must specify the transaction you are committing"); } TransactionId activemqTx = transactions.remove(stompTx); if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); } for (StompSubscription sub : subscriptionsByConsumerId.values()) { try { sub.onStompAbort(activemqTx); } catch (Exception e) { throw new ProtocolException("Transaction abort failed", false, e); } } pedingAcks.clear(); TransactionInfo tx = new TransactionInfo(); tx.setConnectionId(connectionId); tx.setTransactionId(activemqTx); tx.setType(TransactionInfo.ROLLBACK); sendToActiveMQ(tx, createResponseHandler(command)); }
protected void onStompAbort(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); if (stompTx == null) { throw new ProtocolException("Must specify the transaction you are committing"); } TransactionId activemqTx = transactions.remove(stompTx); if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); } for (StompSubscription sub : subscriptionsByConsumerId.values()) { try { sub.onStompAbort(activemqTx); } catch (Exception e) { throw new ProtocolException("Transaction abort failed", false, e); } } pedingAcks.clear(); TransactionInfo tx = new TransactionInfo(); tx.setConnectionId(connectionId); tx.setTransactionId(activemqTx); tx.setType(TransactionInfo.ROLLBACK); sendToActiveMQ(tx, createResponseHandler(command)); }
protected void onStompSend(StompFrame command) throws IOException, JMSException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); headers.remove("transaction"); ActiveMQMessage message = convertMessage(command); message.setProducerId(producerId); MessageId id = new MessageId(producerId, messageIdGenerator.getNextSequenceId()); message.setMessageId(id); message.setJMSTimestamp(System.currentTimeMillis()); if (stompTx != null) { TransactionId activemqTx = transactions.get(stompTx); if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); } message.setTransactionId(activemqTx); } message.onSend(); sendToActiveMQ(message, createResponseHandler(command)); }
protected void onStompAbort(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders(); String stompTx = headers.get(Stomp.Headers.TRANSACTION); if (stompTx == null) { throw new ProtocolException("Must specify the transaction you are committing"); } TransactionId activemqTx = transactions.remove(stompTx); if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); } for (StompSubscription sub : subscriptionsByConsumerId.values()) { try { sub.onStompAbort(activemqTx); } catch (Exception e) { throw new ProtocolException("Transaction abort failed", false, e); } } pedingAcks.clear(); TransactionInfo tx = new TransactionInfo(); tx.setConnectionId(connectionId); tx.setTransactionId(activemqTx); tx.setType(TransactionInfo.ROLLBACK); sendToActiveMQ(tx, createResponseHandler(command)); }
protected void onStompSend(StompFrame command) throws IOException, JMSException { checkConnected(); Map<String, String> headers = command.getHeaders(); String destination = headers.get(Stomp.Headers.Send.DESTINATION); if (destination == null) { throw new ProtocolException("SEND received without a Destination specified!"); } String stompTx = headers.get(Stomp.Headers.TRANSACTION); headers.remove("transaction"); ActiveMQMessage message = convertMessage(command); message.setProducerId(producerId); MessageId id = new MessageId(producerId, messageIdGenerator.getNextSequenceId()); message.setMessageId(id); if (stompTx != null) { TransactionId activemqTx = transactions.get(stompTx); if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); } message.setTransactionId(activemqTx); } message.onSend(); message.beforeMarshall(null); sendToActiveMQ(message, createResponseHandler(command)); }
protected void onStompUnsubscribe(StompFrame command) throws ProtocolException { checkConnected(); Map<String, String> headers = command.getHeaders();
protected void onStompSend(StompFrame command) throws IOException, JMSException { checkConnected(); Map<String, String> headers = command.getHeaders(); String destination = headers.get(Stomp.Headers.Send.DESTINATION); if (destination == null) { throw new ProtocolException("SEND received without a Destination specified!"); } String stompTx = headers.get(Stomp.Headers.TRANSACTION); headers.remove("transaction"); ActiveMQMessage message = convertMessage(command); message.setProducerId(producerId); MessageId id = new MessageId(producerId, messageIdGenerator.getNextSequenceId()); message.setMessageId(id); if (stompTx != null) { TransactionId activemqTx = transactions.get(stompTx); if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); } message.setTransactionId(activemqTx); } message.onSend(); message.beforeMarshall(null); sendToActiveMQ(message, createResponseHandler(command)); }
protected void onStompSend(StompFrame command) throws IOException, JMSException { checkConnected(); Map<String, String> headers = command.getHeaders(); String destination = headers.get(Stomp.Headers.Send.DESTINATION); if (destination == null) { throw new ProtocolException("SEND received without a Destination specified!"); } String stompTx = headers.get(Stomp.Headers.TRANSACTION); headers.remove("transaction"); ActiveMQMessage message = convertMessage(command); message.setProducerId(producerId); MessageId id = new MessageId(producerId, messageIdGenerator.getNextSequenceId()); message.setMessageId(id); if (stompTx != null) { TransactionId activemqTx = transactions.get(stompTx); if (activemqTx == null) { throw new ProtocolException("Invalid transaction id: " + stompTx); } message.setTransactionId(activemqTx); } message.onSend(); message.beforeMarshall(null); sendToActiveMQ(message, createResponseHandler(command)); }
protected void onStompSubscribe(StompFrame command) throws ProtocolException { checkConnected(); FrameTranslator translator = findTranslator(command.getHeaders().get(Stomp.Headers.TRANSFORMATION)); Map<String, String> headers = command.getHeaders();