Search in sources :

Example 1 with PubSubPublishingService

use of org.folio.circulation.services.PubSubPublishingService in project mod-circulation by folio-org.

the class DeclareClaimedReturnedItemAsMissingResource method declareClaimedReturnedItemAsMissing.

private void declareClaimedReturnedItemAsMissing(RoutingContext routingContext) {
    final WebContext context = new WebContext(routingContext);
    final EventPublisher eventPublisher = new EventPublisher(new PubSubPublishingService(context));
    createRequest(routingContext).after(request -> processDeclareClaimedReturnedItemAsMissing(routingContext, request)).thenCompose(r -> r.after(eventPublisher::publishMarkedAsMissingLoanEvent)).thenApply(r -> r.map(toFixedValue(NoContentResponse::noContent))).thenAccept(context::writeResultToHttpResponse);
}
Also used : UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) Clients(org.folio.circulation.support.Clients) LoanRepository(org.folio.circulation.infrastructure.storage.loans.LoanRepository) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) WebContext(org.folio.circulation.support.http.server.WebContext) Router(io.vertx.ext.web.Router) CompletableFuture(java.util.concurrent.CompletableFuture) ValidationErrorFailure.singleValidationError(org.folio.circulation.support.ValidationErrorFailure.singleValidationError) RoutingContext(io.vertx.ext.web.RoutingContext) NotesRepository(org.folio.circulation.infrastructure.storage.notes.NotesRepository) ChangeItemStatusRequest(org.folio.circulation.domain.representations.ChangeItemStatusRequest) PubSubPublishingService(org.folio.circulation.services.PubSubPublishingService) JsonObject(io.vertx.core.json.JsonObject) ChangeItemStatusService(org.folio.circulation.services.ChangeItemStatusService) Result.failed(org.folio.circulation.support.results.Result.failed) ItemRepository(org.folio.circulation.infrastructure.storage.inventory.ItemRepository) NoteCreator(org.folio.circulation.domain.notes.NoteCreator) Result.succeeded(org.folio.circulation.support.results.Result.succeeded) Loan(org.folio.circulation.domain.Loan) MappingFunctions.toFixedValue(org.folio.circulation.support.results.MappingFunctions.toFixedValue) NotInItemStatusValidator(org.folio.circulation.domain.validation.NotInItemStatusValidator) Result(org.folio.circulation.support.results.Result) EventPublisher(org.folio.circulation.services.EventPublisher) RouteRegistration(org.folio.circulation.support.RouteRegistration) StoreLoanAndItem(org.folio.circulation.StoreLoanAndItem) NoContentResponse(org.folio.circulation.support.http.server.NoContentResponse) HttpClient(io.vertx.core.http.HttpClient) WebContext(org.folio.circulation.support.http.server.WebContext) EventPublisher(org.folio.circulation.services.EventPublisher) PubSubPublishingService(org.folio.circulation.services.PubSubPublishingService)

Aggregations

HttpClient (io.vertx.core.http.HttpClient)1 JsonObject (io.vertx.core.json.JsonObject)1 Router (io.vertx.ext.web.Router)1 RoutingContext (io.vertx.ext.web.RoutingContext)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 CompletableFuture.completedFuture (java.util.concurrent.CompletableFuture.completedFuture)1 StoreLoanAndItem (org.folio.circulation.StoreLoanAndItem)1 Loan (org.folio.circulation.domain.Loan)1 NoteCreator (org.folio.circulation.domain.notes.NoteCreator)1 ChangeItemStatusRequest (org.folio.circulation.domain.representations.ChangeItemStatusRequest)1 NotInItemStatusValidator (org.folio.circulation.domain.validation.NotInItemStatusValidator)1 ItemRepository (org.folio.circulation.infrastructure.storage.inventory.ItemRepository)1 LoanRepository (org.folio.circulation.infrastructure.storage.loans.LoanRepository)1 NotesRepository (org.folio.circulation.infrastructure.storage.notes.NotesRepository)1 UserRepository (org.folio.circulation.infrastructure.storage.users.UserRepository)1 ChangeItemStatusService (org.folio.circulation.services.ChangeItemStatusService)1 EventPublisher (org.folio.circulation.services.EventPublisher)1 PubSubPublishingService (org.folio.circulation.services.PubSubPublishingService)1 Clients (org.folio.circulation.support.Clients)1 RouteRegistration (org.folio.circulation.support.RouteRegistration)1