MessageCampaignService¶
-
public interface
MessageCampaignService
¶ The
MessageCampaignService
allows the management of the message campaigns and the campaign enrollments. It is exposed as OSGi service.
Methods¶
campaignCompleted¶
deleteCampaign¶
enroll¶
-
void
enroll
(CampaignRequest enrollRequest)¶ Enrolls the external ID into the campaign as specified in the request. The enrolled entity will have events raised against it, according to the campaign definition.
Parameters: - enrollRequest – the enrollment request
getAllCampaignRecords¶
-
List<CampaignRecord>
getAllCampaignRecords
()¶ Returns all
CampaignRecord
s.Returns: all campaign records.
getCampaignRecord¶
-
CampaignRecord
getCampaignRecord
(String campaignName)¶ Returns
CampaignRecord
of the provided name.Parameters: - campaignName – the name of the campaign
Returns: campaign record of the given name
getCampaignTimings¶
-
Map<String, List<DateTime>>
getCampaignTimings
(String externalId, String campaignName, DateTime startDate, DateTime endDate)¶ Gets the complete schedule of the messages to deliver for the given campaign name and the given external ID of the enrollment. The schedule contains messages sent after startDate and before endDate. It is returned as a map, indexed by message names.
Parameters: - externalId – external ID of the enrollment
- campaignName – the name of the message campaign
- startDate – the beginning of the time window, determining the included messages
- endDate – the ending of the time window, determining the included messages
getLatestCampaignMessage¶
getNextCampaignMessage¶
loadCampaigns¶
-
void
loadCampaigns
()¶ Loads message campaigns from the module settings and creates or updates necessary records, based on the loaded definition.
Throws: - IOException – in case of problems reading the module settings
rescheduleMessageJob¶
saveCampaign¶
-
void
saveCampaign
(CampaignRecord campaign)¶ Creates a new message campaign, provided a one with such name does not exist yet.
Parameters: - campaign – the campaign to create
scheduleJobsForEnrollment¶
-
void
scheduleJobsForEnrollment
(CampaignEnrollment enrollment)¶ Schedules jobs for the given campaign enrollment.
Parameters: - enrollment – the enrollment to schedule the jobs for
search¶
-
List<CampaignEnrollmentRecord>
search
(CampaignEnrollmentsQuery query)¶ Searches and returns the
CampaignEnrollmentRecord
s as per the criteria in the givenCampaignEnrollmentsQuery
The query consists of various criteria based on Status, ExternalId and CampaignName of the CampaignEnrollmentParameters: - query – the query containing search criteria
Returns: the list of enrollment records matching provided criteria
stopAll¶
-
void
stopAll
(CampaignEnrollmentsQuery query)¶ Unenrolls all campaign enrollments which match criteria provided in the
CampaignEnrollmentsQuery
.Parameters: - query – the query containing criteria of the records to unenroll
stopAll¶
-
void
stopAll
(CampaignEnrollmentsQuery query, boolean deleteEnrollments)¶ Unenrolls and deletes all campaign enrollments which match criteria provided in the
CampaignEnrollmentsQuery
.Parameters: - query – the query containing criteria of the records to unenroll and delete
unenroll¶
-
void
unenroll
(String externalId, String campaignName)¶ Unenrolls the external ID from the campaign as specified in the request. The entity will no longer receive events from the campaign.
Parameters: - externalId – a client defined ID to identify the enrollment
- campaignName – the campaign from which the entity should be unenrolled
unscheduleJobsForEnrollment¶
-
void
unscheduleJobsForEnrollment
(CampaignEnrollment enrollment)¶ Unschedules all the jobs for the given campaign enrollment.
Parameters: - enrollment – the enrollment to unschedule jobs for
unscheduleMessageJob¶
-
void
unscheduleMessageJob
(CampaignMessageRecord campaignMessageRecord)¶ Unschedules all the jobs set up to send campaign messages for enrollments for the given campaign.
Parameters: - campaignMessageRecord – one of the campaign’s message to unschedule jobs for
updateEnrollment¶
-
void
updateEnrollment
(CampaignRequest enrollRequest, Long enrollmentId)¶ Updates existing campaign enrollment with data specified in the request.
Parameters: - enrollRequest – the enrollment request holding the data to update
- enrollmentId – the ID of the enrollment
updateEnrollments¶
-
void
updateEnrollments
(Long campaignId)¶ Reschedules jobs for all active enrollments, assigned to the message campaign of the provided ID.
Parameters: - campaignId – the ID of the message campaign
Throws: - IllegalArgumentException – in case the message campaign of the given ID does not exist