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

时间:2017-07-31 21:32:21

标签: testing avro activepivot

如何将数据从Hadoop Avro源加载到ActivePivot商店?

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

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

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

在弹簧配置中,您需要定义消息chanell

@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(...)));