如何将数据从Hadoop Avro源加载到ActivePivot存储中?



如何将数据从Hadoop Avro源加载到ActivePivot存储中?

查看您应该有权访问的 ActivePivot 沙盒项目,并查看通道用于将数据保存到数据存储的位置。

假设您有应发布到多维数据集的类。

public class PostVectorFact {
private final LocalDate date;
//other fields
//getters, equals, hashCode
}

在 Spring 配置中,您需要定义消息 channe

@Autowired
protected IDatastore datastore;
@Autowired
protected KeepArbitraryEpochPolicy epochPolicy;
@Autowired
protected LocationHelper locationHelper;
public IMessageChannel<String, Object> returnsRealTimeChannel() {
return pojoMessageChannelFactory().createChannel("RealTimeReturns", DataStoreConstants.RETURNS_STORE, tuplePublisher());
}
@Bean
ITuplePublisher<String> tuplePublisher() {
return new VersionCheckingTuplePublisher(datastore, DataStoreConstants.RETURNS_STORE, DataStoreConstants.LATEST_RETURNS_STORE, 2L, epochPolicy, locationHelper);
}
@Bean
public CubeReturnsFactPublisher cubeReturnsFactPublisher() {
return new CubeReturnsFactPublisher(returnsRealTimeChannel());
}

以及发布者类本身:

public class CubeReturnsFactPublisher {
IMessageChannel<String, Object> messageChannel;
public CubeReturnsFactPublisher(IMessageChannel<String, Object> messageChannel) {
super();
this.messageChannel = messageChannel;
}
public void publish(List<ReturnVectorFact> facts) {
messageChannel.sendMessage("", facts);
}
}

发布数据的方式:

cubeReturnsFactPublisher.publish(Collections.singletonList(new PostVectorFact(...)));

最新更新