【问题标题】:How do I load data from a Hadoop Avro source into ActivePivot store?如何将 Hadoop Avro 源中的数据加载到 ActivePivot 存储中?
【发布时间】:2017-07-31 21:32:20
【问题描述】:

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

【问题讨论】:

标签: testing avro activepivot


【解决方案1】:

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

【讨论】:

  • 我不认为 ActivePivot Sandbox 项目可用。但是,我已经验证了 ActivePivot 支持 URL (support.quartetfs.com)。我看不到任何样本来加载自定义源。我的要求是将数据加载到作为 avro 文件(例如:Employee.avro)接收的数据存储中。我唯一能看到的为自定义源编写代码的是,它应该实现 ISource 接口并覆盖 fetch 和 listen 方法。
【解决方案2】:

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

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

在你的spring配置中你需要定义消息通道

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-31
    • 2020-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多