Class UserCreationListener
- java.lang.Object
-
- com.broadleafcommerce.customer.messaging.UserCreationListener
-
@DataRouteByKey("customer") public class UserCreationListener extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
USER_ID_ATTR_KEY
-
Constructor Summary
Constructors Constructor Description UserCreationListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, CustomerService<Customer> customerService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CustomerService<Customer>
getCustomerService()
protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService
getIdempotentConsumptionService()
void
listen(@NonNull org.springframework.messaging.Message<UserCreatedEvent> message)
protected void
processStateChange(@NonNull org.springframework.messaging.Message<UserCreatedEvent> message)
Based on the contents of theUserCreatedEvent
, update the Customer with the providedUser
dataprotected void
updateCustomer(User user, Customer customer)
Updates an existing customer.
-
-
-
Field Detail
-
USER_ID_ATTR_KEY
public static final String USER_ID_ATTR_KEY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UserCreationListener
public UserCreationListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, CustomerService<Customer> customerService)
-
-
Method Detail
-
listen
@StreamListener("userCreationInput") public void listen(@NonNull @NonNull org.springframework.messaging.Message<UserCreatedEvent> message)
-
processStateChange
protected void processStateChange(@NonNull @NonNull org.springframework.messaging.Message<UserCreatedEvent> message)
Based on the contents of theUserCreatedEvent
, update the Customer with the providedUser
data- Parameters:
message
- the message to be processed
-
updateCustomer
protected void updateCustomer(User user, Customer customer)
Updates an existing customer. We're only concerned with Auth's user_id field.- Parameters:
user
-customer
-
-
getIdempotentConsumptionService
protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService getIdempotentConsumptionService()
-
getCustomerService
protected CustomerService<Customer> getCustomerService()
-
-