Class BroadleafSystemEvent
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.broadleafcommerce.common.event.BroadleafApplicationEvent
org.broadleafcommerce.common.event.BroadleafSystemEvent
- All Implemented Interfaces:
Serializable
A BroadleafApplicationEvent used so that we can communicate with the ScheduledJobsAndEvents module without having a dependency on it. By publishing a Spring Event with this detail, the ScheduledJobsAndEvents module will listen for this event and create a corresponding com.broadleafcommerce.jobsevents.domain.SystemEvent to be consumed.
To send an event, inject the ApplicationContext
and publish the event:
@Autowired private ApplicationContext appCtx; ... appCtx.publishEvent(new BroadleafSystemEvent("CONSUMER_TYPE", BroadleafEventScopeType.VM, BroadleafEventWorkerType.SITE, true);
- Author:
- Jay Aisenbrey (cja769)
- See Also:
-
ApplicationEventPublisher.publishEvent(org.springframework.context.ApplicationEvent)
- Serialized Form
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Constant for how the event should be consumedstatic enum
Which type of worker is qualified to handle the eventNested classes/interfaces inherited from class org.broadleafcommerce.common.event.BroadleafApplicationEvent
BroadleafApplicationEvent.ContextVars
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String,
BroadleafSystemEventDetail> protected String
protected boolean
Fields inherited from class org.broadleafcommerce.common.event.BroadleafApplicationEvent
context
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorsConstructorDescriptionBroadleafSystemEvent
(String type, Map<String, BroadleafSystemEventDetail> detailMap, BroadleafSystemEvent.BroadleafEventScopeType scopeType, BroadleafSystemEvent.BroadleafEventWorkerType workerType, boolean universal) BroadleafSystemEvent
(String type, BroadleafSystemEvent.BroadleafEventScopeType scopeType, BroadleafSystemEvent.BroadleafEventWorkerType workerType, boolean universal) -
Method Summary
Modifier and TypeMethodDescriptiongetType()
boolean
If this event is constructed the exact same way with the exact same data, we can gain a performance increase by combining multiple events into 1.void
setDetailMap
(Map<String, BroadleafSystemEventDetail> detailMap) void
void
void
setUniversal
(boolean universal) void
Methods inherited from class org.broadleafcommerce.common.event.BroadleafApplicationEvent
getCatalogId, getContext, getCurrencyCode, getLocaleCode, getProfileId, getSiteId, getTimeZoneId
Methods inherited from class org.springframework.context.ApplicationEvent
getTimestamp
Methods inherited from class java.util.EventObject
getSource, toString
-
Field Details
-
detailMap
-
type
-
scopeType
-
workerType
-
universal
protected boolean universal
-
-
Constructor Details
-
BroadleafSystemEvent
public BroadleafSystemEvent(String type, Map<String, BroadleafSystemEventDetail> detailMap, BroadleafSystemEvent.BroadleafEventScopeType scopeType, BroadleafSystemEvent.BroadleafEventWorkerType workerType, boolean universal) - Parameters:
type
- should match the com.broadleafcommerce.jobsevents.service.SystemEventConsumer#getTypedetailMap
- details passed to the event consumerscopeType
- how the event should be consumedworkerType
- what type of workers should consume ituniversal
- used for a performance optimization when sending multiple events at the same time, usually true
-
BroadleafSystemEvent
public BroadleafSystemEvent(String type, BroadleafSystemEvent.BroadleafEventScopeType scopeType, BroadleafSystemEvent.BroadleafEventWorkerType workerType, boolean universal)
-
-
Method Details
-
getDetailMap
-
setDetailMap
-
getType
-
setType
-
getScopeType
-
setScopeType
-
getWorkerType
-
setWorkerType
-
isUniversal
public boolean isUniversal()If this event is constructed the exact same way with the exact same data, we can gain a performance increase by combining multiple events into 1.- Returns:
-
setUniversal
public void setUniversal(boolean universal)
-