@Override protected void publish(PublishableEvents publishableEvents) { String aggregateType = publishableEvents.getAggregateType(); String aggregateId = publishableEvents.getEntityId(); List<EventIdTypeAndData> eventsWithIds = publishableEvents.getEventsWithIds(); List<Subscription> subscriptions; synchronized (aggregateTypeToSubscription) { List<Subscription> x = aggregateTypeToSubscription.get(aggregateType); subscriptions = x == null ? null : new ArrayList<>(x); } if (subscriptions != null) for (Subscription subscription : subscriptions) { for (EventIdTypeAndData event : eventsWithIds) { if (subscription.isInterestedIn(aggregateType, event.getEventType())) subscription.handler.apply(new SerializedEvent(event.getId(), aggregateId, aggregateType, event.getEventData(), event.getEventType(), aggregateId.hashCode() % 8, eventOffset.getAndIncrement(), new EventContext(event.getId().asString()), event.getMetadata())); } } }
@Override protected void publish(PublishableEvents publishableEvents) { String aggregateType = publishableEvents.getAggregateType(); String aggregateId = publishableEvents.getEntityId(); List<EventIdTypeAndData> eventsWithIds = publishableEvents.getEventsWithIds(); List<Subscription> subscriptions; synchronized (aggregateTypeToSubscription) { List<Subscription> x = aggregateTypeToSubscription.get(aggregateType); subscriptions = x == null ? null : new ArrayList<>(x); } if (subscriptions != null) for (Subscription subscription : subscriptions) { for (EventIdTypeAndData event : eventsWithIds) { if (subscription.isInterestedIn(aggregateType, event.getEventType())) subscription.handler.apply(new SerializedEvent(event.getId(), aggregateId, aggregateType, event.getEventData(), event.getEventType(), aggregateId.hashCode() % 8, eventOffset.getAndIncrement(), new EventContext(event.getId().asString()), event.getMetadata())); } } }
private SerializedEvent makeSerializedEvent(StompEvent stompEvent) { return new SerializedEvent( stompEvent.getId(), stompEvent.getEntityId(), stompEvent.getEntityType(), stompEvent.getEventData(), stompEvent.getEventType(), stompEvent.getSwimlane(), stompEvent.getOffset(), new EventContext(stompEvent.getEventToken()), Optional.empty()); }
private SerializedEvent makeSerializedEvent(StompEvent stompEvent) { return new SerializedEvent( stompEvent.getId(), stompEvent.getEntityId(), stompEvent.getEntityType(), stompEvent.getEventData(), stompEvent.getEventType(), stompEvent.getSwimlane(), stompEvent.getOffset(), new EventContext(stompEvent.getEventToken()), Optional.empty()); }
private SerializedEvent toSerializedEvent(ConsumerRecord<String, String> record) { PublishedEvent pe = JSonMapper.fromJson(record.value(), PublishedEvent.class); return new SerializedEvent( Int128.fromString(pe.getId()), pe.getEntityId(), pe.getEntityType(), pe.getEventData(), pe.getEventType(), record.partition(), record.offset(), EtopEventContext.make(pe.getId(), record.topic(), record.partition(), record.offset()), pe.getMetadata()); }
private SerializedEvent toSerializedEvent(ConsumerRecord<String, String> record) { PublishedEvent pe = JSonMapper.fromJson(record.value(), PublishedEvent.class); return new SerializedEvent( Int128.fromString(pe.getId()), pe.getEntityId(), pe.getEntityType(), pe.getEventData(), pe.getEventType(), record.partition(), record.offset(), EtopEventContext.make(pe.getId(), record.topic(), record.partition(), record.offset()), pe.getMetadata()); }