protected void sendReceipt(StompFrame command) { final String receiptId = command.getHeaders().get(Stomp.Headers.RECEIPT_REQUESTED); if (receiptId != null) { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); try { sendToStomp(sc); } catch (IOException e) { LOG.warn("Could not send a receipt for {}", command, e); } } }
protected void sendReceipt(StompFrame command) { final String receiptId = command.getHeaders().get(Stomp.Headers.RECEIPT_REQUESTED); if (receiptId != null) { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); try { sendToStomp(sc); } catch (IOException e) { LOG.warn("Could not send a receipt for " + command, e); } } }
protected void sendReceipt(StompFrame command) { final String receiptId = command.getHeaders().get(Stomp.Headers.RECEIPT_REQUESTED); if (receiptId != null) { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); try { sendToStomp(sc); } catch (IOException e) { LOG.warn("Could not send a receipt for {}", command, e); } } }
protected void sendReceipt(StompFrame command) { final String receiptId = command.getHeaders().get(Stomp.Headers.RECEIPT_REQUESTED); if (receiptId != null) { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); try { sendToStomp(sc); } catch (IOException e) { LOG.warn("Could not send a receipt for " + command, e); } } }
protected void sendReceipt(StompFrame command) { final String receiptId = command.getHeaders().get(Stomp.Headers.RECEIPT_REQUESTED); if (receiptId != null) { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); try { sendToStomp(sc); } catch (IOException e) { LOG.warn("Could not send a receipt for {}", command, e); } } }
public void onResponse(ProtocolConverter converter, Response response) throws IOException { if (response.isException()) { // Generally a command can fail.. but that does not invalidate the connection. // We report back the failure but we don't close the connection. Throwable exception = ((ExceptionResponse)response).getException(); handleException(exception, command); } else { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); stompTransport.sendToStomp(sc); } } };
@Override public void onResponse(StompProtocolConverter converter, Response response) throws IOException { if (response.isException()) { // Generally a command can fail.. but that does not invalidate the connection. // We report back the failure but we don't close the connection. Throwable exception = ((ExceptionResponse) response).getException(); handleException(exception, command); } else { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); stompTransport.sendToStomp(sc); } } };
@Override public void onResponse(ProtocolConverter converter, Response response) throws IOException { if (response.isException()) { // Generally a command can fail.. but that does not invalidate the connection. // We report back the failure but we don't close the connection. Throwable exception = ((ExceptionResponse)response).getException(); handleException(exception, command); } else { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); stompTransport.sendToStomp(sc); } } };
@Override public void onResponse(ProtocolConverter converter, Response response) throws IOException { if (response.isException()) { // Generally a command can fail.. but that does not invalidate the connection. // We report back the failure but we don't close the connection. Throwable exception = ((ExceptionResponse)response).getException(); handleException(exception, command); } else { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); stompTransport.sendToStomp(sc); } } };
@Override public void onResponse(ProtocolConverter converter, Response response) throws IOException { if (response.isException()) { // Generally a command can fail.. but that does not invalidate the connection. // We report back the failure but we don't close the connection. Throwable exception = ((ExceptionResponse)response).getException(); handleException(exception, command); } else { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); stompTransport.sendToStomp(sc); } } };
@Override public void onResponse(StompProtocolConverter converter, Response response) throws IOException { if (response.isException()) { // Generally a command can fail.. but that does not invalidate the connection. // We report back the failure but we don't close the connection. Throwable exception = ((ExceptionResponse) response).getException(); handleException(exception, command); } else { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); stompTransport.sendToStomp(sc); } } };
void onMessageDispatch(MessageDispatch md, String ackId) throws IOException, JMSException { ActiveMQMessage message = (ActiveMQMessage)md.getMessage(); if (ackMode.equals(CLIENT_ACK) || ackMode.equals(INDIVIDUAL_ACK)) { synchronized (this) { dispatchedMessage.put(message.getMessageId(), md); } } else if (ackMode.equals(AUTO_ACK)) { MessageAck ack = new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, 1); protocolConverter.getStompTransport().sendToActiveMQ(ack); } boolean ignoreTransformation = false; if (transformation != null && !( message instanceof ActiveMQBytesMessage ) ) { message.setReadOnlyProperties(false); message.setStringProperty(Stomp.Headers.TRANSFORMATION, transformation); } else { if (message.getStringProperty(Stomp.Headers.TRANSFORMATION) != null) { ignoreTransformation = true; } } StompFrame command = protocolConverter.convertMessage(message, ignoreTransformation); command.setAction(Stomp.Responses.MESSAGE); if (subscriptionId != null) { command.getHeaders().put(Stomp.Headers.Message.SUBSCRIPTION, subscriptionId); } if (ackId != null) { command.getHeaders().put(Stomp.Headers.Message.ACK_ID, ackId); } protocolConverter.getStompTransport().sendToStomp(command); }
void onMessageDispatch(MessageDispatch md, String ackId) throws IOException, JMSException { ActiveMQMessage message = (ActiveMQMessage)md.getMessage(); if (ackMode.equals(CLIENT_ACK) || ackMode.equals(INDIVIDUAL_ACK)) { synchronized (this) { dispatchedMessage.put(message.getMessageId(), md); } } else if (ackMode.equals(AUTO_ACK)) { MessageAck ack = new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, 1); protocolConverter.getStompTransport().sendToActiveMQ(ack); } boolean ignoreTransformation = false; if (transformation != null && !( message instanceof ActiveMQBytesMessage ) ) { message.setReadOnlyProperties(false); message.setStringProperty(Stomp.Headers.TRANSFORMATION, transformation); } else { if (message.getStringProperty(Stomp.Headers.TRANSFORMATION) != null) { ignoreTransformation = true; } } StompFrame command = protocolConverter.convertMessage(message, ignoreTransformation); command.setAction(Stomp.Responses.MESSAGE); if (subscriptionId != null) { command.getHeaders().put(Stomp.Headers.Message.SUBSCRIPTION, subscriptionId); } if (ackId != null) { command.getHeaders().put(Stomp.Headers.Message.ACK_ID, ackId); } protocolConverter.getStompTransport().sendToStomp(command); }
void onMessageDispatch(MessageDispatch md, String ackId) throws IOException, JMSException { ActiveMQMessage message = (ActiveMQMessage)md.getMessage(); if (ackMode.equals(CLIENT_ACK) || ackMode.equals(INDIVIDUAL_ACK)) { synchronized (this) { dispatchedMessage.put(message.getMessageId(), md); } } else if (ackMode.equals(AUTO_ACK)) { MessageAck ack = new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, 1); protocolConverter.getStompTransport().sendToActiveMQ(ack); } boolean ignoreTransformation = false; if (transformation != null && !( message instanceof ActiveMQBytesMessage ) ) { message.setReadOnlyProperties(false); message.setStringProperty(Stomp.Headers.TRANSFORMATION, transformation); } else { if (message.getStringProperty(Stomp.Headers.TRANSFORMATION) != null) { ignoreTransformation = true; } } StompFrame command = protocolConverter.convertMessage(message, ignoreTransformation); command.setAction(Stomp.Responses.MESSAGE); if (subscriptionId != null) { command.getHeaders().put(Stomp.Headers.Message.SUBSCRIPTION, subscriptionId); } if (ackId != null) { command.getHeaders().put(Stomp.Headers.Message.ACK_ID, ackId); } protocolConverter.getStompTransport().sendToStomp(command); }
@Override public void onResponse(ProtocolConverter converter, Response response) throws IOException { if (response.isException()) { // Generally a command can fail.. but that does not invalidate the connection. // We report back the failure but we don't close the connection. Throwable exception = ((ExceptionResponse)response).getException(); handleException(exception, cmd); } else { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); stompTransport.sendToStomp(sc); ConsumerControl control = new ConsumerControl(); control.setPrefetch(prefetch); control.setDestination(actualDest); control.setConsumerId(id); sendToActiveMQ(control, null); } } };
@Override public void onResponse(ProtocolConverter converter, Response response) throws IOException { if (response.isException()) { // Generally a command can fail.. but that does not invalidate the connection. // We report back the failure but we don't close the connection. Throwable exception = ((ExceptionResponse)response).getException(); handleException(exception, cmd); } else { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); stompTransport.sendToStomp(sc); ConsumerControl control = new ConsumerControl(); control.setPrefetch(prefetch); control.setDestination(actualDest); control.setConsumerId(id); sendToActiveMQ(control, null); } } };
@Override public void onResponse(ProtocolConverter converter, Response response) throws IOException { if (response.isException()) { // Generally a command can fail.. but that does not invalidate the connection. // We report back the failure but we don't close the connection. Throwable exception = ((ExceptionResponse)response).getException(); handleException(exception, cmd); } else { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); stompTransport.sendToStomp(sc); ConsumerControl control = new ConsumerControl(); control.setPrefetch(prefetch); control.setDestination(actualDest); control.setConsumerId(id); sendToActiveMQ(control, null); } } };
@Override public void onResponse(StompProtocolConverter converter, Response response) throws IOException { if (response.isException()) { // Generally a command can fail.. but that does not invalidate the connection. // We report back the failure but we don't close the connection. Throwable exception = ((ExceptionResponse) response).getException(); handleException(exception, cmd); } else { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); stompTransport.sendToStomp(sc); ConsumerControl control = new ConsumerControl(); control.setPrefetch(prefetch); control.setDestination(actualDest); control.setConsumerId(id); sendToActiveMQ(control, null); } } };
@Override public void onResponse(StompProtocolConverter converter, Response response) throws IOException { if (response.isException()) { // Generally a command can fail.. but that does not invalidate the connection. // We report back the failure but we don't close the connection. Throwable exception = ((ExceptionResponse) response).getException(); handleException(exception, cmd); } else { StompFrame sc = new StompFrame(); sc.setAction(Stomp.Responses.RECEIPT); sc.setHeaders(new HashMap<String, String>(1)); sc.getHeaders().put(Stomp.Headers.Response.RECEIPT_ID, receiptId); stompTransport.sendToStomp(sc); ConsumerControl control = new ConsumerControl(); control.setPrefetch(prefetch); control.setDestination(actualDest); control.setConsumerId(id); sendToActiveMQ(control, null); } } };
public StompFrame convertMessage(ProtocolConverter converter, ActiveMQMessage message) throws IOException, JMSException { StompFrame command = new StompFrame(); command.setAction(Stomp.Responses.MESSAGE); Map<String, String> headers = new HashMap<String, String>(25); command.setHeaders(headers); FrameTranslator.Helper.copyStandardHeadersFromMessageToFrame(converter, message, command, this); if (message.getDataStructureType() == ActiveMQTextMessage.DATA_STRUCTURE_TYPE) { ActiveMQTextMessage msg = (ActiveMQTextMessage)message.copy(); command.setContent(msg.getText().getBytes("UTF-8")); } else if (message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE) { ActiveMQBytesMessage msg = (ActiveMQBytesMessage)message.copy(); msg.setReadOnlyBody(true); byte[] data = new byte[(int)msg.getBodyLength()]; msg.readBytes(data); headers.put(Stomp.Headers.CONTENT_LENGTH, "" + data.length); command.setContent(data); } else if (message.getDataStructureType() == ActiveMQMessage.DATA_STRUCTURE_TYPE && AdvisorySupport.ADIVSORY_MESSAGE_TYPE.equals(message.getType())) { FrameTranslator.Helper.copyStandardHeadersFromMessageToFrame( converter, message, command, this); String body = marshallAdvisory(message.getDataStructure()); command.setContent(body.getBytes("UTF-8")); } return command; }