Java Code Examples for org.springframework.messaging.simp.stomp.StompHeaderAccessor#getReceipt()

The following examples show how to use org.springframework.messaging.simp.stomp.StompHeaderAccessor#getReceipt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StompSubProtocolErrorHandler.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Override
@Nullable
public Message<byte[]> handleClientMessageProcessingError(@Nullable Message<byte[]> clientMessage, Throwable ex) {
	StompHeaderAccessor accessor = StompHeaderAccessor.create(StompCommand.ERROR);
	accessor.setMessage(ex.getMessage());
	accessor.setLeaveMutable(true);

	StompHeaderAccessor clientHeaderAccessor = null;
	if (clientMessage != null) {
		clientHeaderAccessor = MessageHeaderAccessor.getAccessor(clientMessage, StompHeaderAccessor.class);
		if (clientHeaderAccessor != null) {
			String receiptId = clientHeaderAccessor.getReceipt();
			if (receiptId != null) {
				accessor.setReceiptId(receiptId);
			}
		}
	}

	return handleInternal(accessor, EMPTY_PAYLOAD, ex, clientHeaderAccessor);
}
 
Example 2
Source File: StompSubProtocolErrorHandler.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Override
@Nullable
public Message<byte[]> handleClientMessageProcessingError(@Nullable Message<byte[]> clientMessage, Throwable ex) {
	StompHeaderAccessor accessor = StompHeaderAccessor.create(StompCommand.ERROR);
	accessor.setMessage(ex.getMessage());
	accessor.setLeaveMutable(true);

	StompHeaderAccessor clientHeaderAccessor = null;
	if (clientMessage != null) {
		clientHeaderAccessor = MessageHeaderAccessor.getAccessor(clientMessage, StompHeaderAccessor.class);
		if (clientHeaderAccessor != null) {
			String receiptId = clientHeaderAccessor.getReceipt();
			if (receiptId != null) {
				accessor.setReceiptId(receiptId);
			}
		}
	}

	return handleInternal(accessor, EMPTY_PAYLOAD, ex, clientHeaderAccessor);
}
 
Example 3
Source File: StompSubProtocolErrorHandler.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Override
public Message<byte[]> handleClientMessageProcessingError(Message<byte[]> clientMessage, Throwable ex) {
	StompHeaderAccessor accessor = StompHeaderAccessor.create(StompCommand.ERROR);
	accessor.setMessage(ex.getMessage());
	accessor.setLeaveMutable(true);

	StompHeaderAccessor clientHeaderAccessor = null;
	if (clientMessage != null) {
		clientHeaderAccessor = MessageHeaderAccessor.getAccessor(clientMessage, StompHeaderAccessor.class);
		String receiptId = clientHeaderAccessor.getReceipt();
		if (receiptId != null) {
			accessor.setReceiptId(receiptId);
		}
	}

	return handleInternal(accessor, EMPTY_PAYLOAD, ex, clientHeaderAccessor);
}
 
Example 4
Source File: StompSubProtocolHandler.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Nullable
private String getDisconnectReceipt(SimpMessageHeaderAccessor simpHeaders) {
	String name = StompHeaderAccessor.DISCONNECT_MESSAGE_HEADER;
	Message<?> message = (Message<?>) simpHeaders.getHeader(name);
	if (message != null) {
		StompHeaderAccessor accessor = MessageHeaderAccessor.getAccessor(message, StompHeaderAccessor.class);
		if (accessor != null) {
			return accessor.getReceipt();
		}
	}
	return null;
}
 
Example 5
Source File: StompSubProtocolHandler.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Nullable
private String getDisconnectReceipt(SimpMessageHeaderAccessor simpHeaders) {
	String name = StompHeaderAccessor.DISCONNECT_MESSAGE_HEADER;
	Message<?> message = (Message<?>) simpHeaders.getHeader(name);
	if (message != null) {
		StompHeaderAccessor accessor = MessageHeaderAccessor.getAccessor(message, StompHeaderAccessor.class);
		if (accessor != null) {
			return accessor.getReceipt();
		}
	}
	return null;
}