Closed zymr-keshav closed 5 years ago
You must add the call to watchForReceipt
before your publish
call. Otherwise the receipt may be missed.
I am doing this way but unable to receive any:
this.rxStompService.watchForReceipt('161718', function(frame: Frame) {
console.log('%c Watch for receipt', 'color: green');
console.log({ frame });
});
const message = { command: this.command.GEt_USER_LIST };
const headers = Object.assign(this.headers, { receipt: '161718' });
this.rxStompService.publish({
destination: `/message/${this.uniqueID}`,
body: JSON.stringify(message),
headers: headers
});
Which broker are you using? Does your broker support receipts?
STOMP
STOMP is the protocol. I wanted to know - is it RabbitMQ, Spring Boot, Active MQ or any other?
its' Spring Boot
I have tested the following code with RabbitMQ as broker:
const message = `Message generated at ${new Date}`;
const receipt_id = UUID.UUID();
this.rxStompService.watchForReceipt(receipt_id, (frame) => {
console.log('Receipt: ', frame);
});
this.rxStompService.publish({destination: '/topic/demo', body: message, headers: {receipt: receipt_id}});
I can confirm it receive the receipts. Please see the change-set at https://github.com/stomp-js/ng2-stompjs-angular7/commit/9c70530b84f6de75c2b27225c21c0a42b9902098. Full code at https://github.com/stomp-js/ng2-stompjs-angular7 - branch publish-acknowledgements
.
It may be worth checking whether Spring Boot supports receipts for message publishes.
Closing because lack of activity.
What I want to achieve is once I ( FE ) confirm that WebSocket handshake has been established then want to send a message to the server and here comes a method in RxStomp watchForReceipt and I am using that method but a bit confused how does server acknowledge this? does Server need to do something for acknowledging or it will automatically be acknowledged?
we have Java spring boot on BE side and I am sending this way
and write this one in another place
BUT this is never getting logged.
Am I missing something or Server also need to do logic to acknowledge this request?