Class DefaultCustomerService
- java.lang.Object
-
- com.broadleafcommerce.search.index.customer.service.DefaultCustomerService
-
- All Implemented Interfaces:
CustomerService
public class DefaultCustomerService extends Object implements CustomerService
Default implementation to readcustomers
from the Customer Service.
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
CLIENT_REGISTRATION_ID
-
Constructor Summary
Constructors Constructor Description DefaultCustomerService(org.springframework.web.reactive.function.client.WebClient webClient, String customerEndpoint, String readCustomerIdsPath, String readCustomersPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addBatchCustomerIdFilter(org.springframework.web.util.UriBuilder uriBuilder, List<String> ids)
protected String
buildReadBatchOfCustomerIdsUri(String startId, int batchSize)
protected String
buildReadBatchOfCustomersUri(List<String> ids)
protected String
getCustomerEndpoint()
protected String
getReadCustomerIdsPath()
protected String
getReadCustomersPath()
String
getServiceClient()
The service client to use when calling inventory services.protected org.springframework.web.reactive.function.client.WebClient
getWebClient()
List<String>
readBatchOfCustomerIds(String startId, int batchSize)
Reads a batch of IDs to be placed in a queue for processing.List<com.broadleafcommerce.search.customer.core.domain.Customer>
readBatchOfCustomers(List<String> ids)
Reads a batch ofCustomers
by their IDs.Optional<com.broadleafcommerce.search.customer.core.domain.Customer>
readCustomer(@NonNull String id)
Reads a batch ofCustomers
by their IDs.void
setServiceClient(String serviceClient)
The service client to use when calling inventory services.
-
-
-
Field Detail
-
CLIENT_REGISTRATION_ID
protected static final String CLIENT_REGISTRATION_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
readBatchOfCustomerIds
public List<String> readBatchOfCustomerIds(@Nullable String startId, int batchSize) throws com.broadleafcommerce.search.api.SearchIndexException
Description copied from interface:CustomerService
Reads a batch of IDs to be placed in a queue for processing.- Specified by:
readBatchOfCustomerIds
in interfaceCustomerService
- Parameters:
startId
- The starting IDbatchSize
- The size of the batch- Returns:
- A list of customer IDs.
- Throws:
com.broadleafcommerce.search.api.SearchIndexException
- if reading the customer ids fails.
-
buildReadBatchOfCustomerIdsUri
protected String buildReadBatchOfCustomerIdsUri(@Nullable String startId, int batchSize)
-
readBatchOfCustomers
public List<com.broadleafcommerce.search.customer.core.domain.Customer> readBatchOfCustomers(List<String> ids) throws com.broadleafcommerce.search.api.SearchIndexException
Description copied from interface:CustomerService
Reads a batch ofCustomers
by their IDs.- Specified by:
readBatchOfCustomers
in interfaceCustomerService
- Parameters:
ids
- A list of customer IDs.- Returns:
- A list of customers or an empty list.
- Throws:
com.broadleafcommerce.search.api.SearchIndexException
- if reading the customer fails.
-
readCustomer
public Optional<com.broadleafcommerce.search.customer.core.domain.Customer> readCustomer(@NonNull @NonNull @NonNull String id) throws com.broadleafcommerce.search.api.SearchIndexException
Description copied from interface:CustomerService
Reads a batch ofCustomers
by their IDs.- Specified by:
readCustomer
in interfaceCustomerService
- Parameters:
id
- A customer id- Returns:
- A customer optional or
Optional.empty()
- Throws:
com.broadleafcommerce.search.api.SearchIndexException
- if reading the customer fails.
-
addBatchCustomerIdFilter
protected void addBatchCustomerIdFilter(org.springframework.web.util.UriBuilder uriBuilder, List<String> ids)
-
getWebClient
protected org.springframework.web.reactive.function.client.WebClient getWebClient()
-
getCustomerEndpoint
protected String getCustomerEndpoint()
-
getReadCustomerIdsPath
protected String getReadCustomerIdsPath()
-
getReadCustomersPath
protected String getReadCustomersPath()
-
getServiceClient
public String getServiceClient()
The service client to use when calling inventory services. Default is "indexerclient"
-
setServiceClient
public void setServiceClient(String serviceClient)
The service client to use when calling inventory services. Default is "indexerclient"
-
-