Implement notification mechanism

This commit is contained in:
aditya.chandel
2024-12-27 00:09:19 -07:00
parent e08cd4e8d3
commit ea716bfb69
10 changed files with 129 additions and 70 deletions
+6 -1
View File
@@ -3,6 +3,7 @@ import {RxStompService} from './book/service/rx-stomp.service';
import {Message} from '@stomp/stompjs';
import {BookService} from './book/service/book.service';
import {Action, parseBookNotification} from './book/model/book-notification.model';
import {EventService} from './book/service/event.service';
@Component({
selector: 'app-root',
@@ -12,7 +13,7 @@ import {Action, parseBookNotification} from './book/model/book-notification.mode
})
export class AppComponent implements OnInit {
constructor(private bookService: BookService, private rxStompService: RxStompService) {
constructor(private bookService: BookService, private rxStompService: RxStompService, private eventService: EventService) {
}
ngOnInit(): void {
@@ -24,6 +25,10 @@ export class AppComponent implements OnInit {
this.bookService.handleRemovedBookIds(notification.removedBookIds!);
}
});
this.rxStompService.watch('/topic/logs').subscribe((message: Message) => {
this.eventService.handleIncomingEvent(message.body);
});
}
sendMessage() {