/** * {@inheritDoc} */ @Override public final Topology newTopology() { return provider.newTopology(); } /**
@Override public Topology topology() { return feed.topology(); }
/** * Subscribe to a published topic. * This is a model that allows jobs to subscribe to * streams published by other jobs. * @param <T> Tuple type * @param te TopologyElement whose Topology to add to * @param topic Topic to subscribe to. * @param streamType Type of the stream. * @return Stream containing published tuples. * * @see #publish(TStream, String, Class) */ public static <T> TStream<T> subscribe(TopologyElement te, String topic, Class<T> streamType) { Topology topology = te.topology(); Supplier<RuntimeServices> rts = topology.getRuntimeServiceSupplier(); return te.topology().events(new SubscriberSetup<T>(topic, streamType, rts)); }
@Override public TSink<JsonObject> eventsForDevice(String fqDeviceId, TStream<JsonObject> stream, String eventId, int qos) { return stream.sink(new IotpGWDeviceEventsFixed(connector, fqDeviceId, eventId, qos)); }
public static TStream<JsonObject> sourceData(Topology topology) { TStream<String> seed = topology.strings("A1", "B7", "C4", "A4", "B3", "C99", "A102", "B43", "B13", "A0", "C700"); return seed.map(s -> { JsonObject j = new JsonObject(); j.addProperty("id", s.substring(0, 1)); j.addProperty("value", Integer.valueOf(s.substring(1))); return j; }); }
public static void createApplicationOne(Topology topology, JsonObject config) { TStream<String> out = topology.strings("APP1_A", "APP1_B", "APP1_C"); PublishSubscribe.publish(out, "appOne", String.class); } }
/** * Subscribe to the specified topics and yield a stream of tuples from the published RabbitMQ records. * * @param toTupleFn A function that yields a tuple from a byte array, * @param queue the specified RabbitMQ queue * @param <T> A function that yields a tuple from a * @return stream of tuples */ public <T> TStream<T> subscribe(Function<byte[], T> toTupleFn, String queue) { return topology.events(new RabbitmqSubscriber<>(connector, queue, toTupleFn)); }
protected static TStream<Integer> sourceData(Topology topology) { return topology.of(1, 4, 102, 0); }
@Override public TSink<JsonObject> events(TStream<JsonObject> stream, Function<JsonObject, String> eventId, UnaryOperator<JsonObject> payload, Function<JsonObject, Integer> qos) { return stream.sink( new IotpGWDeviceEventsFunction(connector, jo -> fqDeviceId, eventId, payload, qos)); }
/** * Subscribe to a published topic. * This is a model that allows jobs to subscribe to * streams published by other jobs. * @param <T> Tuple type * @param te TopologyElement whose Topology to add to * @param topic Topic to subscribe to. * @param streamType Type of the stream. * @return Stream containing published tuples. * * @see #publish(TStream, String, Class) */ public static <T> TStream<T> subscribe(TopologyElement te, String topic, Class<T> streamType) { Topology topology = te.topology(); Supplier<RuntimeServices> rts = topology.getRuntimeServiceSupplier(); return te.topology().events(new SubscriberSetup<T>(topic, streamType, rts)); }
private TStream<Command> allCommands() { if (commandStream == null) commandStream = topology.events(new IotpDeviceCommands(connector)); return commandStream; }
/** * {@inheritDoc} */ @Override public final Topology newTopology(String name) { return provider.newTopology(name); } /**
@Override public Topology topology() { return feed.topology(); }
@Override public TSink<JsonObject> eventsForDevice(Function<JsonObject, String> fqDeviceId, TStream<JsonObject> stream, Function<JsonObject, String> eventId, UnaryOperator<JsonObject> payload, Function<JsonObject, Integer> qos) { return stream.sink(new IotpGWDeviceEventsFunction(connector, fqDeviceId, eventId, payload, qos)); }
/** * {@inheritDoc} */ @Override public final Topology newTopology() { return provider.newTopology(); } /**
/** * {@inheritDoc} */ @Override public final Topology newTopology(String name) { return provider.newTopology(name); } /**