January 2018
Intermediate to advanced
414 pages
10h 29m
English
We can now modify our service to return a publisher for a single customer using Mono. Let's first change our CustomerService interface:
package com.microservices.chapter4import reactor.core.publisher.Monointerface CustomerService { fun getCustomer(id: Int) : Mono<Customer?> fun searchCustomers(nameFilter: String): List<Customer>}
Then, we will change our implementation on the CustomerServiceImpl class:
package com.microservices.chapter4import com.microservices.chapter4.Customer.Telephoneimport org.springframework.stereotype.Componentimport reactor.core.publisher.toMonoimport java.util.concurrent.ConcurrentHashMap@Componentclass CustomerServiceImpl : CustomerService { companion object { val initialCustomers = arrayOf(Customer(1, ...Read now
Unlock full access