use of com.metabroadcast.common.queue.MessagingException in project atlas-deer by atlasapi.
the class AbstractEquivalentContentStore method updateContent.
@Override
public final void updateContent(Id contentId) throws WriteException {
metricRegistry.meter(updateContent + METER_CALLED).mark();
try {
lock.lock(contentId);
Content content = resolveId(contentId);
ImmutableList<Id> ids = ImmutableList.of(contentId);
ListenableFuture<OptionalMap<Id, EquivalenceGraph>> graphs = graphStore.resolveIds(ids);
Optional<EquivalenceGraph> possibleGraph = get(graphs).get(content.getId());
EquivalenceGraph graph;
if (possibleGraph.isPresent()) {
graph = possibleGraph.get();
update(graph, content);
} else {
graph = EquivalenceGraph.valueOf(content.toRef());
update(graph, content);
}
sendEquivalentContentChangedMessage(content, graph);
} catch (MessagingException | InterruptedException e) {
metricRegistry.meter(updateContent + METER_FAILURE).mark();
throw new WriteException("Updating " + contentId, e);
} finally {
lock.unlock(contentId);
}
}
use of com.metabroadcast.common.queue.MessagingException 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.queue.MessagingException 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.queue.MessagingException in project atlas-deer by atlasapi.
the class AbstractSegmentStore method writeMessage.
private void writeMessage(WriteResult<Segment, Segment> result) {
ResourceUpdatedMessage msg = createEntityUpdatedMessage(result);
try {
Id resourceId = msg.getUpdatedResource().getId();
sender.sendMessage(msg, Longs.toByteArray(resourceId.longValue()));
} catch (MessagingException e) {
log.error("Failed to send resource update message [{}] - {}", msg.getUpdatedResource().toString(), e.toString());
}
}
use of com.metabroadcast.common.queue.MessagingException in project atlas-deer by atlasapi.
the class ConsumingMessageSender method suppressed.
private MessagingException suppressed(List<MessagingException> exceptions) {
MessagingException ex = new MessagingException("An exception occurred processing message");
exceptions.forEach(ex::addSuppressed);
return ex;
}
Aggregations