diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/service/LibraryProcessingService.java b/booklore-api/src/main/java/com/adityachandel/booklore/service/LibraryProcessingService.java index 7c73bbe21..d35b981fd 100644 --- a/booklore-api/src/main/java/com/adityachandel/booklore/service/LibraryProcessingService.java +++ b/booklore-api/src/main/java/com/adityachandel/booklore/service/LibraryProcessingService.java @@ -69,6 +69,7 @@ public class LibraryProcessingService { if (bookDTO != null) { BookNotification notification = BookNotification.builder().action(BOOK_ADDED).addedBook(bookDTO).build(); notificationService.sendMessage("/topic/books", notification); + notificationService.sendMessage("/topic/logs", "Book added: " + bookDTO.getFileName()); log.info("Processed file: {}", libraryFile.getFilePath()); } } diff --git a/booklore-api/src/main/resources/application.yaml b/booklore-api/src/main/resources/application.yaml index 7ab7156f0..5cf7224fe 100644 --- a/booklore-api/src/main/resources/application.yaml +++ b/booklore-api/src/main/resources/application.yaml @@ -22,7 +22,7 @@ spring: hibernate: naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl - show-sql: true + show-sql: false properties: hibernate: jdbc: diff --git a/booklore-ui/src/app/app.component.ts b/booklore-ui/src/app/app.component.ts index f8cb002dd..e823cb725 100644 --- a/booklore-ui/src/app/app.component.ts +++ b/booklore-ui/src/app/app.component.ts @@ -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() { diff --git a/booklore-ui/src/app/book/component/layout/app.topbar.component.html b/booklore-ui/src/app/book/component/layout/app.topbar.component.html index 9205fb1e8..089eef5e8 100644 --- a/booklore-ui/src/app/book/component/layout/app.topbar.component.html +++ b/booklore-ui/src/app/book/component/layout/app.topbar.component.html @@ -1,8 +1,6 @@