use of com.metabroadcast.common.time.Timestamp in project atlas-persistence by atlasapi.
the class EquivalenceChangeMessenger method sendMessage.
public void sendMessage(LookupEntry subject, Set<Long> outgoingIdsAdded, Set<Long> outgoingIdsRemoved, Set<Long> outgoingIdsUnchanged, Set<String> sources) {
try {
String messageId = UUID.randomUUID().toString();
Timestamp timestamp = timestamper.timestamp();
EquivalenceChangeMessage message = new EquivalenceChangeMessage(messageId, timestamp, subject.id(), outgoingIdsAdded, outgoingIdsRemoved, outgoingIdsUnchanged, sources);
sender.sendMessage(message, getMessagePartitionKey(subject));
} catch (Exception e) {
log.error("Failed to send equiv result message: " + subject, e);
}
}
use of com.metabroadcast.common.time.Timestamp in project atlas-deer by atlasapi.
the class AbstractScheduleStore method sendUpdateMessage.
private void sendUpdateMessage(Publisher source, List<ScheduleHierarchy> content, ScheduleBlocksUpdate update, Channel channel, Interval interval) throws WriteException {
try {
String messageId = UUID.randomUUID().toString();
Timestamp messageTimestamp = Timestamp.of(DateTime.now(DateTimeZones.UTC));
ScheduleRef updateRef = scheduleRef(content, channel, interval);
ImmutableSet<BroadcastRef> staleRefs = broadcastRefs(update.getStaleEntries());
ScheduleUpdateMessage message = new ScheduleUpdateMessage(messageId, messageTimestamp, new ScheduleUpdate(source, updateRef, staleRefs));
Id channelId = message.getScheduleUpdate().getSchedule().getChannel();
messageSender.sendMessage(message, Longs.toByteArray(channelId.longValue()));
} catch (MessagingException e) {
throw new WriteException(e);
}
}
use of com.metabroadcast.common.time.Timestamp in project atlas-deer by atlasapi.
the class ContentEquivalenceAssertionLegacyTransformer method transform.
public EquivalenceAssertionMessage transform(ContentEquivalenceAssertionMessage leg) {
String mid = leg.getMessageId();
Timestamp ts = leg.getTimestamp();
ResourceRef subj = LegacyTransformer.resourceRef(leg.getEntityId(), leg.getEntitySource(), leg.getEntityType(), leg.getTimestamp());
Set<ResourceRef> adjacents = toResourceRef(leg);
Set<Publisher> srcs = ImmutableSet.copyOf(Iterables.transform(leg.getSources(), Publisher.FROM_KEY));
return new EquivalenceAssertionMessage(mid, ts, subj, adjacents, srcs);
}
use of com.metabroadcast.common.time.Timestamp in project atlas-persistence by atlasapi.
the class MongoScheduleStore method sendUpdateMessage.
private void sendUpdateMessage(Publisher publisher, Channel channel, Interval interval) {
String mid = UUID.randomUUID().toString();
Timestamp ts = timestamper.timestamp();
String src = publisher.key();
String cid = idCodec.encode(BigInteger.valueOf(channel.getId()));
DateTime start = interval.getStart();
DateTime end = interval.getEnd();
ScheduleUpdateMessage msg = new ScheduleUpdateMessage(mid, ts, src, cid, start, end);
try {
messageSender.sendMessage(msg, msg.getChannel().getBytes());
} catch (MessagingException e) {
String errMsg = String.format("%s %s %s", src, cid, interval);
log.error(errMsg, e);
}
}
use of com.metabroadcast.common.time.Timestamp in project atlas-persistence by atlasapi.
the class ContentEquivalenceAssertionMessenger method messageFrom.
private ContentEquivalenceAssertionMessage messageFrom(Content subject, ImmutableList<Content> adjacents, ImmutableSet<String> sources) {
String messageId = UUID.randomUUID().toString();
Timestamp timestamp = timestamper.timestamp();
String subjectId = entityIdCodec.encode(BigInteger.valueOf(subject.getId()));
String subjectType = subject.getClass().getSimpleName().toLowerCase();
String subjectSource = subject.getPublisher().key();
ImmutableList<ContentEquivalenceAssertionMessage.AdjacentRef> adjacentRefs = adjacents(adjacents);
return new ContentEquivalenceAssertionMessage(messageId, timestamp, subjectId, subjectType, subjectSource, adjacentRefs, sources);
}
Aggregations