use of com.ibm.streamsx.health.hapi.mapper.AdtToModelMapper in project streamsx.health by IBMStreams.
the class AdtIngest method run.
@Override
public void run() {
Topology topology = new Topology("AdtIngest");
AdtToModelMapper mapper = new AdtToModelMapper();
addDependencies(topology);
HapiMessageSupplier supplier = new HapiMessageSupplier(getPort());
supplier.setMessageClass(ADT_AXX.class);
TStream<Message> messages = topology.endlessSource(supplier);
// transform message to ADTEvent object
TStream<ADTEvent> adtEvents = messages.multiTransform(message -> {
return mapper.messageToModel(message);
});
// publish data as JSON
PublishAdtEvent.publish(adtEvents, getTopic());
try {
StreamsContextFactory.getStreamsContext(StreamsContext.Type.DISTRIBUTED).submit(topology);
} catch (Exception e) {
TRACE.error("Unable to submit topology", e);
}
}
Aggregations