Search in sources :

Example 6 with SystemEvent

use of com.icthh.xm.ms.entity.domain.kafka.SystemEvent in project xm-ms-entity by xm-online.

the class SystemEventMapperUnitTest method createEventWithoutDates.

private SystemEvent createEventWithoutDates() {
    SystemEvent event = new SystemEvent();
    Map<String, Object> data = new HashMap<>();
    event.setData(data);
    data.put(Constants.ID, DEFAULT_ID);
    data.put(Constants.FIRST_NAME, DEFAULT_FIRST_NAME);
    data.put(Constants.LAST_NAME, DEFAULT_LAST_NAME);
    data.put(Constants.IMAGE_URL, DEFAULT_IMAGE_URL);
    data.put(Constants.ACTIVATED, DEFAULT_ACTIVATED);
    data.put(Constants.CREATED_DATE, "");
    data.put(Constants.LAST_MODIFIED_DATE, "");
    data.put(Constants.USER_KEY, DEFAULT_USER_KEY);
    return event;
}
Also used : SystemEvent(com.icthh.xm.ms.entity.domain.kafka.SystemEvent) HashMap(java.util.HashMap)

Example 7 with SystemEvent

use of com.icthh.xm.ms.entity.domain.kafka.SystemEvent in project xm-ms-entity by xm-online.

the class ProfileEventProducer method createEventJson.

public String createEventJson(Object data, String eventType) {
    SystemEvent event = null;
    try {
        event = buildSystemEvent(eventType);
        event.setData(data);
        return mapper.writeValueAsString(event);
    } catch (JsonProcessingException e) {
        log.warn("Event creation error, eventType = {}, data = {}", eventType, event.getData(), e);
    }
    return null;
}
Also used : SystemEvent(com.icthh.xm.ms.entity.domain.kafka.SystemEvent) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 8 with SystemEvent

use of com.icthh.xm.ms.entity.domain.kafka.SystemEvent in project xm-ms-entity by xm-online.

the class SystemQueueConsumerLepKeyResolver method getAppendSegments.

/**
 * LEP extension key specification:<br>
 * {@code ChangeState$$<xm-entity-type-key>$$<next-state-key>}
 * <p>
 * Add to method name {@code <xm-entity-type-key} and {@code <state-key>} to the end.
 *
 * @param baseKey        base LEP key (prefix), can be {@code null}
 * @param method         method data on what LEP call occurs
 * @param managerService LEP manager service
 * @return dynamic value of LEP base key
 */
@Override
protected String[] getAppendSegments(SeparatorSegmentedLepKey baseKey, LepMethod method, LepManagerService managerService) {
    SystemEvent event = getRequiredParam(method, PARAM_EVENT, SystemEvent.class);
    String translatedEventType = translateToLepConvention(event.getEventType());
    return new String[] { translatedEventType };
}
Also used : SystemEvent(com.icthh.xm.ms.entity.domain.kafka.SystemEvent)

Aggregations

SystemEvent (com.icthh.xm.ms.entity.domain.kafka.SystemEvent)8 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JavaTimeModule (com.fasterxml.jackson.datatype.jsr310.JavaTimeModule)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 Retryable (org.springframework.retry.annotation.Retryable)1