List of usage examples for org.springframework.messaging.simp.stomp StompHeaders getDestination
@Nullable
public String getDestination()
From source file:org.springframework.messaging.simp.stomp.DefaultStompSession.java
@Override public Receiptable send(StompHeaders stompHeaders, Object payload) { Assert.hasText(stompHeaders.getDestination(), "Destination header is required"); String receiptId = checkOrAddReceipt(stompHeaders); Receiptable receiptable = new ReceiptHandler(receiptId); StompHeaderAccessor accessor = createHeaderAccessor(StompCommand.SEND); accessor.addNativeHeaders(stompHeaders); Message<byte[]> message = createMessage(accessor, payload); execute(message);//from ww w . ja v a2 s . co m return receiptable; }
From source file:org.springframework.messaging.simp.stomp.DefaultStompSession.java
@Override public Subscription subscribe(StompHeaders stompHeaders, StompFrameHandler handler) { Assert.hasText(stompHeaders.getDestination(), "Destination header is required"); Assert.notNull(handler, "StompFrameHandler must not be null"); String subscriptionId = stompHeaders.getId(); if (!StringUtils.hasText(subscriptionId)) { subscriptionId = String.valueOf(DefaultStompSession.this.subscriptionIndex.getAndIncrement()); stompHeaders.setId(subscriptionId); }/*from w w w . j a va 2 s .c o m*/ checkOrAddReceipt(stompHeaders); Subscription subscription = new DefaultSubscription(stompHeaders, handler); StompHeaderAccessor accessor = createHeaderAccessor(StompCommand.SUBSCRIBE); accessor.addNativeHeaders(stompHeaders); Message<byte[]> message = createMessage(accessor, EMPTY_PAYLOAD); execute(message); return subscription; }