user3090026
user3090026

Reputation: 11

How do I load data from a Hadoop Avro source into ActivePivot store?

How do I load data from a Hadoop Avro source into ActivePivot store?

Upvotes: -1

Views: 164

Answers (2)

schaffe
schaffe

Reputation: 399

Suppose you have class that should be posted to the cube.

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

In your spring configuration you need to define message 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());
}

And the publisher class itself:

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);
    }
}

The way how you publish your data:

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

Upvotes: 0

UserF40
UserF40

Reputation: 3611

Look in the ActivePivot Sandbox project you should have access to and check out where channels are use to persist data to datastores.

Upvotes: 0

Related Questions