Regarding Chronicle-Engine

429 views
Skip to first unread message

Gayatri Bhosale

unread,
Feb 18, 2016, 5:45:32 AM2/18/16
to Chronicle
Hello,

I had done the experiments with chronicle map for writing and reading data.
Now I wants to work on chronicle engine for real time updation on database as per describ on following link http://chronicle.software/products/chronicle-engine/
can you give me sample piece of code for resolve my queries using java ?

Rob Austin

unread,
Feb 18, 2016, 5:47:22 AM2/18/16
to java-ch...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Chronicle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-chronicl...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gayatri Bhosale

unread,
Feb 18, 2016, 6:22:15 AM2/18/16
to Chronicle
I have seen the Samples code from Chronicle-Engine/src/test/java/net/openhft/chronicle/engine/eg/

but for real time updation in database like Oracle . i didn't seen any code.

And how can i achieve chronicle engine functionality by this code.

and also check code of chronicle map done by me, it is correct or not

ChronicleMapBuilder<IntValue, BondVOInterface> builder=ChronicleMapBuilder.of(IntValue.class, BondVOInterface.class)
.entries(1000).averageValueSize(1600);

try (ChronicleMap<IntValue, BondVOInterface> map=builder.createPersistedTo(file)){
BondVOInterface value = map.newValueInstance();
IntValue key = map.newKeyInstance();

for(int i = 0; i<50;i++){
key.setKey1(i);
key.setKey2(i+1);
value.setValue(i);
value.setName("Gayatri ");
map.put(key, value);


}

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

Rob Austin

unread,
Feb 18, 2016, 6:38:26 AM2/18/16
to java-ch...@googlegroups.com
but for real time updation in database like Oracle . i didn't seen any code.


correct we don’t have any examples that work in chronicle engine with oracle


And how can i achieve chronicle engine functionality by this code.

If you want help on your particular issue we offer both support and training on chronicle engine.

We only answer general questions in this forum, 


Rob

Gayatri Bhosale

unread,
Feb 18, 2016, 6:46:29 AM2/18/16
to Chronicle
Ok i want to use this chronicle map functionality in my project for storing large size of data. For that i needed support from your side. Whom suppose to i contact for support.

Gayatri Bhosale

unread,
Feb 18, 2016, 6:47:40 AM2/18/16
to Chronicle
Is there any article regarding chronicle engine for better understanding.


On Thursday, 18 February 2016 16:17:22 UTC+5:30, Rob Austin wrote:

Rob Austin

unread,
Feb 18, 2016, 6:49:58 AM2/18/16
to java-ch...@googlegroups.com
If you are interested in purchasing paid support please contact sa...@chronicle.software

Rob Austin

unread,
Feb 18, 2016, 6:52:45 AM2/18/16
to java-ch...@googlegroups.com
no - currently we only have the test cases and the high level overview thats on the website - but we can offer you paid support to help you get up and running.

Gayatri Bhosale

unread,
Feb 18, 2016, 7:03:47 AM2/18/16
to Chronicle
Is there any difference between Chronicle Map  and Chronicle Engine for performing data operations.?
except File storage.

Rob Austin

unread,
Feb 18, 2016, 7:16:59 AM2/18/16
to java-ch...@googlegroups.com
In Summary - Chronicle engine wraps both chronicle map and chronicle queue, chronicle engine is more high level and works with chronicle wire, chronicle engine is ideal when you have clustered servers and many clients, especially when these client's wish to get the data from the servers, but don’t wish to hold all the data locally. Chronicle engine is also designed to support numerous maps and queues over the same socket connection, so one instance of chronicle engine can hold many maps and many queues.

Rob

Gayatri Bhosale

unread,
Feb 18, 2016, 8:10:52 AM2/18/16
to java-ch...@googlegroups.com

Is Map, Queue, engine and wire are realted with each other internally in chronicle engine or we have to relate them explicitly?
Do u have any sample code realted to this stuff

You received this message because you are subscribed to a topic in the Google Groups "Chronicle" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/java-chronicle/hZ1czygVO28/unsubscribe.
To unsubscribe from this group and all its topics, send an email to java-chronicl...@googlegroups.com.

Rob Austin

unread,
Feb 18, 2016, 8:16:49 AM2/18/16
to java-ch...@googlegroups.com

Is Map, Queue, engine and wire are realted with each other internally in chronicle engine or we have to relate them explicitly

no its just the setup code that configs what you want - see 
net.openhft.chronicle.engine.tree.VanillaAsset#forServer(boolean, java.util.function.Consumer<java.lang.Throwable>)
net.openhft.chronicle.engine.tree.VanillaAsset#forRemoteAccess

>Do u have any sample code realted to this stuff
this is an example of using a remote map from with engine

see net.openhft.chronicle.engine.map.RemoteChronicleMapBinaryWireTest

Gayatri Bhosale

unread,
Feb 21, 2016, 11:32:26 PM2/21/16
to Chronicle
Hello,

I want to store my data in map and maintain some order. What should i do?  

Rob Austin

unread,
Feb 22, 2016, 4:41:04 AM2/22/16
to java-ch...@googlegroups.com
if you want to maintain the order that you wrote the data into a chronicle-map ( rather than a custom sort order ) - I suggest you write the data both into a chronicle map and chronicle queue, where you will use the queue to record the order that you put() the data into the map.

We have this feature in a licensed product under development, called chronicle-journal, if you are interested in purchasing a licence, and prepared to wait some months for its development to be completed, please contact  sa...@higherfrequencytrading.com

Rob

Gayatri Bhosale

unread,
Feb 22, 2016, 6:59:53 AM2/22/16
to Chronicle
I want iterate my map on key, but key made up of two variables 1)Price and 2) TimeStamp. 
And for iteration i want price in ascending order and timestamp in descending order, what should i do for that?
Can you give me any sample piece of code for that.  

Rob Austin

unread,
Feb 22, 2016, 7:04:19 AM2/22/16
to java-ch...@googlegroups.com
Can you give me any sample piece of code for that.  

we don’t have any sample code for this use case.

Peter Lawrey

unread,
Feb 22, 2016, 7:34:36 AM2/22/16
to java-ch...@googlegroups.com
Hello Gayatri,
  If you are trying to maintain an order book or market data aggregate, I suggest using Chronicle-Queue to distribute events to build this information which you keep on heap. Even if you have 1 million instruments, the heap space you use should be reasonably small.
  What you want is a sorted list of prices, and a sorted list of quantities for that price (sorted by timestamp and/or volume)

Regards,
   Peter.

Gayatri Bhosale

unread,
Feb 23, 2016, 12:37:04 AM2/23/16
to Chronicle
Can i write data on same queue from multiple writer?

Rob Austin

unread,
Feb 23, 2016, 12:54:37 AM2/23/16
to java-ch...@googlegroups.com
Yes

Sent from my iPhone

Gayatri Bhosale

unread,
Feb 23, 2016, 1:51:04 AM2/23/16
to Chronicle
public static void main(String... ignored) throws IOException {
    Chronicle chronicle = ChronicleQueueBuilder.vanilla(new File("my-queue8")).build();

    ExcerptAppender appender = chronicle.createAppender();
    appender.startExcerpt();
    appender.writeLong(System.currentTimeMillis());
    appender.writeUTF?("Hello World");
    appender.finish();

    ExcerptTailer tailer = chronicle.createTailer().toStart();
    StringBuilder msg = new StringBuilder();
    while (tailer.nextIndex()) {
        long time = tailer.readLong();
        tailer.readUTF?(msg);
        tailer.finish();

        System.out.println(new Date(time) + " - " + msg);

        System.out.println(new Date(time) + " - " + msg);
    }
    chronicle.close();
}
I am trying to execute above code but got following exception.
Exception in thread "main" java.lang.UnsupportedOperationException
	at net.openhft.affinity.impl.NullAffinity.getThreadId(NullAffinity.java:56)
	at net.openhft.affinity.Affinity.getThreadId(Affinity.java:171)
	at net.openhft.affinity.AffinitySupport.getThreadId(AffinitySupport.java:26)
	at net.openhft.chronicle.VanillaChronicle$VanillaAppenderImpl.startExcerpt(VanillaChronicle.java:604)
	at net.openhft.chronicle.VanillaChronicle$VanillaAppenderImpl.startExcerpt(VanillaChronicle.java:596)
.....
at appender.startExcerpt(); line

Peter Lawrey

unread,
Feb 23, 2016, 2:42:58 AM2/23/16
to java-ch...@googlegroups.com

You can write to the same queue from multiple threads, jvms and using Engine from multiple machines.

Gayatri Bhosale

unread,
Feb 23, 2016, 3:35:12 AM2/23/16
to Chronicle
Give me solution for

Exception in thread "main" java.lang.UnsupportedOperationException
	at net.openhft.affinity.impl.NullAffinity.getThreadId(NullAffinity.java:56)
	at net.openhft.affinity.Affinity.getThreadId(Affinity.java:171)
	at net.openhft.affinity.AffinitySupport.getThreadId(AffinitySupport.java:26)
	at net.openhft.chronicle.VanillaChronicle$VanillaAppenderImpl.startExcerpt(VanillaChronicle.java:604)
	at net.openhft.chronicle.VanillaChronicle$VanillaAppenderImpl.startExcerpt(VanillaChronicle.java:596)
.....

Rob Austin

unread,
Feb 23, 2016, 3:52:11 AM2/23/16
to java-ch...@googlegroups.com
Which OS are you using ?


see this code net.openhft.affinity.Affinity

static {
String osName = System.getProperty("os.name");
if(osName.contains("Win") && isWindowsJNAAffinityUsable()) {
LOGGER.trace("Using Windows JNA-based affinity control implementation");
AFFINITY_IMPL = WindowsJNAAffinity.INSTANCE;
} else if(osName.contains("x")) {
if(osName.startsWith("Linux") && isLinuxJNAAffinityUsable()) {
LOGGER.trace("Using Linux JNA-based affinity control implementation");
AFFINITY_IMPL = LinuxJNAAffinity.INSTANCE;
} else if(isPosixJNAAffinityUsable()) {
LOGGER.trace("Using Posix JNA-based affinity control implementation");
AFFINITY_IMPL = PosixJNAAffinity.INSTANCE;
} else {
LOGGER.info("Using dummy affinity control implementation");
AFFINITY_IMPL = NullAffinity.INSTANCE;
}
} else if(osName.contains("Mac") && isMacJNAAffinityUsable()) {
LOGGER.trace("Using MAC OSX JNA-based thread id implementation");
AFFINITY_IMPL = OSXJNAAffinity.INSTANCE;
} else if(osName.contains("SunOS") && isSolarisJNAAffinityUsable()) {
LOGGER.trace("Using Solaris JNA-based thread id implementation");
AFFINITY_IMPL = SolarisJNAAffinity.INSTANCE;
} else {
LOGGER.info("Using dummy affinity control implementation");
AFFINITY_IMPL = NullAffinity.INSTANCE;
}

}

Gayatri Bhosale

unread,
Feb 23, 2016, 6:27:42 AM2/23/16
to Chronicle
Thank you, actually I solved it.

Can I read data from vanilla queue of n'th index? what should i do for that.?

Peter Lawrey

unread,
Feb 23, 2016, 7:59:18 AM2/23/16
to java-ch...@googlegroups.com
You need to call

    boolean success = tailer.index(n);

to get the nth entry.  It returns false if this couldn't be found.

Peter Lawrey

unread,
Feb 23, 2016, 8:02:02 AM2/23/16
to java-ch...@googlegroups.com
Indexes don't start at 0 as they include the cycle number as vanilla-chronicle supports rolling cycles.

The current version of Chronicle Queue v3 has a SingleChronicleQueue which has 1 file per cycle, concurrent writer/readers, and support Wire marshalled objects.


Gayatri Bhosale

unread,
Feb 25, 2016, 12:23:48 AM2/25/16
to Chronicle
Can we apply sort like Collections.sort on Chronicle map? What should I do for apply sorting?

Peter Lawrey

unread,
Feb 25, 2016, 2:01:18 AM2/25/16
to java-ch...@googlegroups.com

As the Map is unordered, you could attempt apply a sort but it wouldn't change the order you get from say an Iterator in a useful way.

Reply all
Reply to author
Forward
0 new messages