@NotNull private ReadMarshallable wireInConsumer() { return (wire) -> { long startWritePosition = outWire.bytes().writePosition(); // if true the next data message will be a system message isSystemMessage = wire.bytes().readRemaining() == 0; if (isSystemMessage) { if (LOG.isDebugEnabled()) LOG.debug("received system-meta-data"); return; } try { readCsp(wire); readTid(wire); } catch (Throwable t) { Jvm.rethrow(t); } try { if (hasCspChanged(cspText)) { if (LOG.isDebugEnabled()) LOG.debug("received meta-data:\n" + wire.bytes().toHexString()); requestContext = requestContextInterner.intern(cspText); viewType = requestContext.viewType(); if (viewType == null) { if (LOG.isDebugEnabled()) LOG.debug("received system-meta-data"); isSystemMessage = true; return; } view = this.assetTree.acquireView(requestContext); if (viewType == MapView.class || viewType == EntrySetView.class || viewType == ValuesCollection.class || viewType == KeySetView.class || viewType == ObjectKVSSubscription.class || viewType == TopicPublisher.class || viewType == Publisher.class || viewType == Reference.class || viewType == TopologySubscription.class || viewType == Replication.class || viewType == Heartbeat.class) { // default to string type if not provided final Class type = requestContext.keyType() == null ? String.class : requestContext.keyType(); final Class type2 = requestContext.valueType() == null ? String.class : requestContext.valueType(); wireAdapter = new GenericWireAdapter(type, type2); } else throw new UnsupportedOperationException("unsupported view type"); } } catch (Throwable e) { LOG.error("", e); outWire.bytes().writePosition(startWritePosition); outWire.writeDocument(true, w -> w.writeEventName(CoreFields.tid).int64(tid)); outWire.writeDocument(false, out -> out.writeEventName(() -> "exception").throwable(e)); logYamlToStandardOut(outWire); rethrow(e); } }; }
public MapKVSSubscription(@NotNull RequestContext requestContext, @NotNull Asset asset) { this(requestContext.viewType(), asset); }