Class UserCreatedEvent
- java.lang.Object
-
- com.broadleafcommerce.customer.messaging.domain.UserCreatedEvent
-
- All Implemented Interfaces:
Serializable
public class UserCreatedEvent extends Object implements Serializable
A message event received when a user in Auth is created.There are two scenarios for this event:
- User registration
- Customer create via API. This triggers a User creation event in Auth.
In case #2, the event originates from an action in Customer. This scenario results in a bit of back and forth. There is a soft link between an Auth user and Customer via an attribute on Customer, the "user_id", but when a customer is created via API, an Auth user does not exist. The flow is:
- Customer is created - Triggers customer creation event
- Auth receives customer creation event - Creates user
- Customer receives user created event - Updates customer with auth generated user ID
- Auth receives customer update event - The User data here has not changed. This is a no-op in Auth.
As mentioned above, keep in mind that auth listens to customer update events. Because of this, customer does not listen to auth User update events. We would have an infinite loop of updates as both services would constantly trigger update events. Therefore, any changes to a customer's data that synchronizes with Auth (e.g. name, email, etc.) after initial creation should only be done via the Customer API.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UserCreatedEvent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
equals(Object o)
Map<String,Object>
getAttributes()
Additional custom information that was provided as part of the user registration process.User
getUser()
int
hashCode()
boolean
isPreview()
Indicates whether the user was created from a preview context.void
setAttributes(Map<String,Object> attributes)
Additional custom information that was provided as part of the user registration process.void
setPreview(boolean preview)
Indicates whether the user was created from a preview context.void
setUser(User user)
String
toString()
-
-
-
Method Detail
-
isPreview
public boolean isPreview()
Indicates whether the user was created from a preview context.
-
getAttributes
public Map<String,Object> getAttributes()
Additional custom information that was provided as part of the user registration process.Client implementations may choose to populate and utilize this field for custom behavior.
-
setUser
public void setUser(User user)
-
setPreview
public void setPreview(boolean preview)
Indicates whether the user was created from a preview context.
-
setAttributes
public void setAttributes(Map<String,Object> attributes)
Additional custom information that was provided as part of the user registration process.Client implementations may choose to populate and utilize this field for custom behavior.
-
canEqual
protected boolean canEqual(Object other)
-
getUser
@NonNull public User getUser()
-
-