Quickstart project: Terracotta/Spring/Ant

Terracotta is a great way to created a distributed heap, but setting up a complete working example using Spring/ANT from scratch takes some time. So one of the things I do in such a situation is to create some kind of template project I can reuse so I’m up and running faster the next time. I decided to share this template with the Java community. The current template project contains a producer of messages (strings) and a consumer of messages. The messages are distrubuted by using a BlockingQueue that is distributed by Terracotta.

The only thing that needs to be changed are the settings in the tc.properties file.

You can download the project here:

Advertisements

7 Responses to Quickstart project: Terracotta/Spring/Ant

  1. Orion Letizi says:

    Sweet. Any desire to add this to the Terracotta forge?

    –Orion

  2. Karthik says:

    In tc.properties it will be nice to remove the =value from line 2. otherwise this example is just great! i always had this steep document/learning curve about TC – and this eg. removed that FUD! Thank you!

  3. ARI ZILKA says:

    Very kewl!

    Have you thought of hosting on the Terracotta Forge? Definitely should put a TC Wiki page up about this project. Use your Terracotta.org account to login to confluence and add a wiki page.

    Would love it if you could do either.

    Thanks for blogging this, BTW!

    –Ari

  4. pveentjer says:

    Thanks for the complements.

    I’ll add it this week to the wiki and perhaps Terracotta Forge.

  5. For those who are using Maven instead of Ant, there are some handy features that would help to kick-start Terracotta-enabled projects from Maven and Maven integration for Eclipse (m2eclipse). I wrote few blog posts about this stuff:

    http://www.jroller.com/eu/entry/maven_indexes
    http://www.jroller.com/eu/entry/maven_project_materialization
    http://www.jroller.com/eu/entry/using_maven_indexes

    You can install m2eclipse from the project web site at http://m2eclipse.codehaus.org/

  6. WS says:

    I stumbled upon your sample code and was happy to found that it is exactly what I looking for in your sample project.

    However, when I run the the project against the current version of Terracotta 2.7.2, I started the producer and it was run fine. But when I start the consumer, I found that it only display the following log message and stay put there:

    [java] [Thread-0]18:53:20,453; INFO;org.tctemplate.Consumer;going to take

    When I look into the admin console, I found that the console did not seemed to be able had registered either the producer nor the consumer (the number of client is 0). I am totally lost as to what happened.

    I am new on Terracotta and as such cannot understand what is happening, is it because of Terracotta version having different setting or …. (Will check that after this). If you do have some idea, please let me know.

    Thanks in advance.

    • pveentjer says:

      If you go to the tc.properties file and go to the second property, there is a string “=value”

      That should be removed and it should work. Yesterday I have used this project as a POC for a customer and it works (in this case with tc 2.7.2 but is also works with older versions like tc 2.5)

      Sorry for the mistake and I’m glad to hear that it is what you are looking for.

      PS:
      Did you install terracotta correctly? In the bin directory of tc there is a script called make-boot-jar. If you run this script, it will generate a jar in the tc_home/lib/dso-boot directory.

      If you check the tc.properties file you will see that you have to set the correct terracotta-dso.jar path. If you have not set it to the correct jar, nothing will be distributed and you won’t get any error! I also made the mistake a few times and was wondering why the application was not distributed..

      If you can’t get the example to work you are free to mail me or add comments to this blogpost.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: