2
votes

I'm looking at the Java API for MarkLogic, which I assume leverages the HTTP protocol for database connections. Is it possible to establish a connection over TCP? If not with the Java API, is it possible to interrogate the database by any means over TCP?

Our current architecture is based on a Microservice architecture concept, and includes a number of stages in any given process flow through the system, including Queueing, Message-brokering, etc. Given the number of steps, I'd like to optimise traffic-speed insofar as possible by leveraging TCP connections.

2

2 Answers

2
votes

The Java API uses the REST Application services on MarkLogic which is fully HTTP 1.1 compliant and TCP/IP.

Not sure what else you are asking for.

For programs written in Java the Java API is the recommended API for most uses http://developer.marklogic.com/products/java

You can also use the REST services directly, but the Java API adds a lot of Best Practice and exposes a higher level of abstraction to make coding simplier.

You can use the REST API from any application that can do HTTP http://docs.marklogic.com/guide/rest-dev/intro

But its a bit more work as you have to construct your HTTP messages directly.

You can also create your own HTTP interface and access it through TCP/IP (HTTP) by making an HTTP App Server (written in XQuery).

Finally if you want very low level but effecient access, using Java or .NET you can use the XCC interface which is more tedious to use but provides a lower level feature for advanced users. This requires the Java or .NET library as the protocol is not documented.

https://developer.marklogic.com/products/xcc

What language are you going to be using and what kinds of operations ? That can help focus on which API is best for you.

-David Lee

2
votes

HTTP is built on TCP. So by definition all HTTP connections are over TCP.

If you'd like a proprietary protocol instead of HTTP, one option is to forget the fact you learned that the Java API uses HTTP and imagine it uses TCP directly. :)

If you really want a proprietary protocol over TCP, you can use the XDBC protocol in combination with the XCC client. By default XDBC uses a wire protocol on TCP that isn't published.