3

I'm working on an application acts as an event service bus for integrating various legacy components....The application utilizes a data store to audit all events and requests sent between systems as well as to store metadata about bus-subscribing endpoints...etc. I want to utilize CouchDB as the data store since it already has many of my application's requirements built-in (REST API, replication, versioning metadata documents...etc). Now here's how my app stack looks like:

  [spring-integration filters/routers/service activators]
  [service layer]
  [dao layer]
  [database]

With the database being CouchDB, I guess the the DAO layer would be either Ektorp Java library or a simple REST client. Here's my question though: isn't building a DAO layer with Ektorp kind of redundant? I mean, why not just use a RestTemplate in the service layer that talks to the views and design documents in CouchDB and save me some coding effort?

Am I missing something?

Thanks,

wsb3383
  • 3,841
  • 12
  • 44
  • 59

2 Answers2

5

I don't know if you have tried it yet, but LightCouch in many ways would act like a REST template. Beside handling document conversion to your domains, and design docs / views, you may use it as a client to CouchDB anywhere in application such as a DAO or service layer.

ahmedyha
  • 328
  • 1
  • 4
  • 8
4

If you roll your own you will have to implement the json parsing / mapping of view results and what not.

Besides efficient view result parsing / object mapping which might be tedious to develop yourself, Ektorp will also help you with view design document management through annotations.

Ektorp has many more features that I think you will appreciate when you dive deeper into CouchDB.

If your app only will perform simple gets of individual documents, then rest template might be enough. Otherwise I don't think you will safe time doing it yourself.

Henrik Barratt Due
  • 5,614
  • 1
  • 21
  • 22