Example Client for ZeroMQ plugin

Have anyone worked with zeromq plugin for elasticserach?
I tried to run SimpleClient provided by the github package, but couldn't
post message on ElasticSearch. Can anyone provide a working example code?

--

Hi Vinay,

Did you install zeromq and the plugin on every hosts? Which version of
zeromq do you use? Which OS?

-- Tanguy

Le lundi 26 novembre 2012 08:24:22 UTC+1, Vinay Gurram a écrit :

Have anyone worked with zeromq plugin for elasticserach?
I tried to run SimpleClient provided by the github package, but couldn't
post message on ElasticSearch. Can anyone provide a working example code?

--

I am using only one system. I installed 2.2 version of ZeroMQ and latest
version of java binding. I am using Fedora 16.

On Monday, November 26, 2012 1:53:07 PM UTC+5:30, Tanguy wrote:

Hi Vinay,

Did you install zeromq and the plugin on every hosts? Which version of
zeromq do you use? Which OS?

-- Tanguy

Le lundi 26 novembre 2012 08:24:22 UTC+1, Vinay Gurram a écrit :

Have anyone worked with zeromq plugin for elasticserach?
I tried to run SimpleClient provided by the github package, but couldn't
post message on ElasticSearch. Can anyone provide a working example code?

--

I am using only one system. I installed 2.2 version of ZeroMQ and latest
version of java binding. I am using Fedora 16.

On Monday, November 26, 2012 1:53:07 PM UTC+5:30, Tanguy wrote:

Hi Vinay,

Did you install zeromq and the plugin on every hosts? Which version of
zeromq do you use? Which OS?

-- Tanguy

Le lundi 26 novembre 2012 08:24:22 UTC+1, Vinay Gurram a écrit :

Have anyone worked with zeromq plugin for elasticserach?
I tried to run SimpleClient provided by the github package, but couldn't
post message on ElasticSearch. Can anyone provide a working example code?

--

Hi,

I changed to 0.19.10 version of elastic search, 2.2 version of ZeroMQ and
0.0.4 SNAPSHOT version of zeroMq transport plugin (
https://github.com/bpaquet/transport-zeromq). I am not able to run the java
SimpleClient in the test package in the github package. The client was able
to send the message but couldn't receive the message from ElasticSearch.
Java program stops at the line where socket.recv function called. I am
thinking that it's waiting for the reply and could not receive the message.

Simple Client ::
//Format function to append the message in the proper format
private static byte[] format(String method, String url, String json,
Integer count) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder(method);
sb.append(ZMQSocket.SEPARATOR);
if (count != null) {
sb.append(url).append(count);
} else {
sb.append(url);
}
sb.append(ZMQSocket.SEPARATOR);

if (json != null) {
sb.append(json);
}
return sb.toString().getBytes("UTF-8");
}
public static void main(String[] args) throws IOException {
final ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket socket = context.socket(ZMQ.DEALER);
socket.connect(address);
socket.send(format(method, url, json, null), 0);

byte[] response = socket.recv(0);//////////////////////////////////////At
this line Java Program stops
System.out.println(response);
}

      finally {

try {
socket.close();
} catch (Exception e2) {
// ignore
}
try {
context.term();
} catch (Exception e2) {
// ignore
}

System.out.printf("%d message(s) sent in %dms", repeat,
System.currentTimeMillis()-startTime);
}

Ononday, November 26, 2012 1:53:07 PM UTC+5:30, Tanguy wrote:

Hi Vinay,

Did you install zeromq and the plugin on every hosts? Which version of
zeromq do you use? Which OS?

-- Tanguy

Le lundi 26 novembre 2012 08:24:22 UTC+1, Vinay Gurram a écrit :

Have anyone worked with zeromq plugin for elasticserach?
I tried to run SimpleClient provided by the github package, but couldn't
post message on ElasticSearch. Can anyone provide a working example code?

--

Hey,

Do you see log messages confirming that the zeromq plugin is listening for
incoming message?

Do you check if a firewall is blocking port 9700?

Since this plugin is not part of elasticsearch core, you can move on
https://github.com/tlrx/transport-zeromq/issues to report any bugs.

-- Tanguy

Le mardi 27 novembre 2012 10:40:26 UTC+1, Vinay Gurram a écrit :

Hi,

I changed to 0.19.10 version of elastic search, 2.2 version of ZeroMQ
and 0.0.4 SNAPSHOT version of zeroMq transport plugin (
https://github.com/bpaquet/transport-zeromq). I am not able to run the
java SimpleClient in the test package in the github package. The client was
able to send the message but couldn't receive the message from
ElasticSearch. Java program stops at the line where socket.recv function
called. I am thinking that it's waiting for the reply and could not receive
the message.

Simple Client ::
//Format function to append the message in the proper format
private static byte[] format(String method, String url, String json,
Integer count) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder(method);
sb.append(ZMQSocket.SEPARATOR);
if (count != null) {
sb.append(url).append(count);
} else {
sb.append(url);
}
sb.append(ZMQSocket.SEPARATOR);

if (json != null) {
sb.append(json);
}
return sb.toString().getBytes("UTF-8");
}
public static void main(String[] args) throws IOException {
final ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket socket = context.socket(ZMQ.DEALER);
socket.connect(address);
socket.send(format(method, url, json, null), 0);

byte[] response = socket.recv(0);//////////////////////////////////////At
this line Java Program stops
System.out.println(response);
}

      finally {

try {
socket.close();
} catch (Exception e2) {
// ignore
}
try {
context.term();
} catch (Exception e2) {
// ignore
}

System.out.printf("%d message(s) sent in %dms", repeat,
System.currentTimeMillis()-startTime);
}

Ononday, November 26, 2012 1:53:07 PM UTC+5:30, Tanguy wrote:

Hi Vinay,

Did you install zeromq and the plugin on every hosts? Which version of
zeromq do you use? Which OS?

-- Tanguy

Le lundi 26 novembre 2012 08:24:22 UTC+1, Vinay Gurram a écrit :

Have anyone worked with zeromq plugin for elasticserach?
I tried to run SimpleClient provided by the github package, but couldn't
post message on ElasticSearch. Can anyone provide a working example code?

--

Hey,

I am a complete newbie. Elastic Search only starts ZeroMQ context and
server. My bad for not reading the whole github document of the
(https://github.com/bpaquet/transport-zeromq), the new plugin is not
supposed to receive any response.I am going through the source code of the
0.0.4SNAPSHOT version. He vomited some of the functions in the new version.
Your version of plugin works fine with the 0.19.2 version. But I am
working on 0.19.11 version :-(. So I have to make changes to your code so
that it might work with the new version of ElasticSearch. Thanks for the
reply :slight_smile:

On Tuesday, November 27, 2012 4:58:00 PM UTC+5:30, Tanguy wrote:

Hey,

Do you see log messages confirming that the zeromq plugin is listening for
incoming message?

Do you check if a firewall is blocking port 9700?

Since this plugin is not part of elasticsearch core, you can move on
https://github.com/tlrx/transport-zeromq/issues to report any bugs.

-- Tanguy

Le mardi 27 novembre 2012 10:40:26 UTC+1, Vinay Gurram a écrit :

Hi,

I changed to 0.19.10 version of elastic search, 2.2 version of ZeroMQ
and 0.0.4 SNAPSHOT version of zeroMq transport plugin (
https://github.com/bpaquet/transport-zeromq). I am not able to run the
java SimpleClient in the test package in the github package. The client was
able to send the message but couldn't receive the message from
ElasticSearch. Java program stops at the line where socket.recv function
called. I am thinking that it's waiting for the reply and could not receive
the message.

Simple Client ::
//Format function to append the message in the proper format
private static byte[] format(String method, String url, String json,
Integer count) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder(method);
sb.append(ZMQSocket.SEPARATOR);
if (count != null) {
sb.append(url).append(count);
} else {
sb.append(url);
}
sb.append(ZMQSocket.SEPARATOR);

if (json != null) {
sb.append(json);
}
return sb.toString().getBytes("UTF-8");
}
public static void main(String[] args) throws IOException {
final ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket socket = context.socket(ZMQ.DEALER);
socket.connect(address);
socket.send(format(method, url, json, null), 0);

byte[] response = socket.recv(0);//////////////////////////////////////At
this line Java Program stops
System.out.println(response);
}

      finally {

try {
socket.close();
} catch (Exception e2) {
// ignore
}
try {
context.term();
} catch (Exception e2) {
// ignore
}

System.out.printf("%d message(s) sent in %dms", repeat,
System.currentTimeMillis()-startTime);
}

Ononday, November 26, 2012 1:53:07 PM UTC+5:30, Tanguy wrote:

Hi Vinay,

Did you install zeromq and the plugin on every hosts? Which version of
zeromq do you use? Which OS?

-- Tanguy

Le lundi 26 novembre 2012 08:24:22 UTC+1, Vinay Gurram a écrit :

Have anyone worked with zeromq plugin for elasticserach?
I tried to run SimpleClient provided by the github package, but
couldn't post message on ElasticSearch. Can anyone provide a working
example code?

--

Glad you find the source of your problem.

Pull requests are greatly appreciated ;o)

-- Tanguy

Le mardi 27 novembre 2012 14:27:32 UTC+1, Vinay Gurram a écrit :

Hey,

I am a complete newbie. Elastic Search only starts ZeroMQ context and
server. My bad for not reading the whole github document of the (
https://github.com/bpaquet/transport-zeromq), the new plugin is not
supposed to receive any response.I am going through the source code of the
0.0.4SNAPSHOT version. He vomited some of the functions in the new version.
Your version of plugin works fine with the 0.19.2 version. But I am
working on 0.19.11 version :-(. So I have to make changes to your code so
that it might work with the new version of ElasticSearch. Thanks for the
reply :slight_smile:

On Tuesday, November 27, 2012 4:58:00 PM UTC+5:30, Tanguy wrote:

Hey,

Do you see log messages confirming that the zeromq plugin is listening
for incoming message?

Do you check if a firewall is blocking port 9700?

Since this plugin is not part of elasticsearch core, you can move on
https://github.com/tlrx/transport-zeromq/issues to report any bugs.

-- Tanguy

Le mardi 27 novembre 2012 10:40:26 UTC+1, Vinay Gurram a écrit :

Hi,

I changed to 0.19.10 version of elastic search, 2.2 version of ZeroMQ
and 0.0.4 SNAPSHOT version of zeroMq transport plugin (
https://github.com/bpaquet/transport-zeromq). I am not able to run the
java SimpleClient in the test package in the github package. The client was
able to send the message but couldn't receive the message from
ElasticSearch. Java program stops at the line where socket.recv function
called. I am thinking that it's waiting for the reply and could not receive
the message.

Simple Client ::
//Format function to append the message in the proper format
private static byte[] format(String method, String url, String json,
Integer count) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder(method);
sb.append(ZMQSocket.SEPARATOR);
if (count != null) {
sb.append(url).append(count);
} else {
sb.append(url);
}
sb.append(ZMQSocket.SEPARATOR);

if (json != null) {
sb.append(json);
}
return sb.toString().getBytes("UTF-8");
}
public static void main(String[] args) throws IOException {
final ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket socket = context.socket(ZMQ.DEALER);
socket.connect(address);
socket.send(format(method, url, json, null), 0);

byte[] response =
socket.recv(0);//////////////////////////////////////At this line Java
Program stops
System.out.println(response);
}

      finally {

try {
socket.close();
} catch (Exception e2) {
// ignore
}
try {
context.term();
} catch (Exception e2) {
// ignore
}

System.out.printf("%d message(s) sent in %dms", repeat,
System.currentTimeMillis()-startTime);
}

Ononday, November 26, 2012 1:53:07 PM UTC+5:30, Tanguy wrote:

Hi Vinay,

Did you install zeromq and the plugin on every hosts? Which version of
zeromq do you use? Which OS?

-- Tanguy

Le lundi 26 novembre 2012 08:24:22 UTC+1, Vinay Gurram a écrit :

Have anyone worked with zeromq plugin for elasticserach?
I tried to run SimpleClient provided by the github package, but
couldn't post message on ElasticSearch. Can anyone provide a working
example code?

--

Hey

Are you going to update the ZeroMq plugin for Elastic Search. If you do
that, that will be a great help for lots of us newbies.

On Tuesday, November 27, 2012 7:04:17 PM UTC+5:30, Tanguy wrote:

Glad you find the source of your problem.

Pull requests are greatly appreciated ;o)

-- Tanguy

Le mardi 27 novembre 2012 14:27:32 UTC+1, Vinay Gurram a écrit :

Hey,

I am a complete newbie. Elastic Search only starts ZeroMQ context and
server. My bad for not reading the whole github document of the (
https://github.com/bpaquet/transport-zeromq), the new plugin is not
supposed to receive any response.I am going through the source code of the
0.0.4SNAPSHOT version. He vomited some of the functions in the new version.
Your version of plugin works fine with the 0.19.2 version. But I am
working on 0.19.11 version :-(. So I have to make changes to your code so
that it might work with the new version of ElasticSearch. Thanks for the
reply :slight_smile:

On Tuesday, November 27, 2012 4:58:00 PM UTC+5:30, Tanguy wrote:

Hey,

Do you see log messages confirming that the zeromq plugin is listening
for incoming message?

Do you check if a firewall is blocking port 9700?

Since this plugin is not part of elasticsearch core, you can move on
https://github.com/tlrx/transport-zeromq/issues to report any bugs.

-- Tanguy

Le mardi 27 novembre 2012 10:40:26 UTC+1, Vinay Gurram a écrit :

Hi,

I changed to 0.19.10 version of elastic search, 2.2 version of ZeroMQ
and 0.0.4 SNAPSHOT version of zeroMq transport plugin (
https://github.com/bpaquet/transport-zeromq). I am not able to run the
java SimpleClient in the test package in the github package. The client was
able to send the message but couldn't receive the message from
ElasticSearch. Java program stops at the line where socket.recv function
called. I am thinking that it's waiting for the reply and could not receive
the message.

Simple Client ::
//Format function to append the message in the proper format
private static byte[] format(String method, String url, String json,
Integer count) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder(method);
sb.append(ZMQSocket.SEPARATOR);
if (count != null) {
sb.append(url).append(count);
} else {
sb.append(url);
}
sb.append(ZMQSocket.SEPARATOR);

if (json != null) {
sb.append(json);
}
return sb.toString().getBytes("UTF-8");
}
public static void main(String[] args) throws IOException {
final ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket socket = context.socket(ZMQ.DEALER);
socket.connect(address);
socket.send(format(method, url, json, null), 0);

byte[] response =
socket.recv(0);//////////////////////////////////////At this line Java
Program stops
System.out.println(response);
}

      finally {

try {
socket.close();
} catch (Exception e2) {
// ignore
}
try {
context.term();
} catch (Exception e2) {
// ignore
}

System.out.printf("%d message(s) sent in %dms", repeat,
System.currentTimeMillis()-startTime);
}

Ononday, November 26, 2012 1:53:07 PM UTC+5:30, Tanguy wrote:

Hi Vinay,

Did you install zeromq and the plugin on every hosts? Which version of
zeromq do you use? Which OS?

-- Tanguy

Le lundi 26 novembre 2012 08:24:22 UTC+1, Vinay Gurram a écrit :

Have anyone worked with zeromq plugin for elasticserach?
I tried to run SimpleClient provided by the github package, but
couldn't post message on ElasticSearch. Can anyone provide a working
example code?

--

Not planned yet. Maybe later if I have enough time :confused:

-- Tanguy

Le mardi 27 novembre 2012 14:40:57 UTC+1, Vinay Gurram a écrit :

Hey

Are you going to update the ZeroMq plugin for Elastic Search. If you do
that, that will be a great help for lots of us newbies.

On Tuesday, November 27, 2012 7:04:17 PM UTC+5:30, Tanguy wrote:

Glad you find the source of your problem.

Pull requests are greatly appreciated ;o)

-- Tanguy

Le mardi 27 novembre 2012 14:27:32 UTC+1, Vinay Gurram a écrit :

Hey,

I am a complete newbie. Elastic Search only starts ZeroMQ context and
server. My bad for not reading the whole github document of the (
https://github.com/bpaquet/transport-zeromq), the new plugin is not
supposed to receive any response.I am going through the source code of the
0.0.4SNAPSHOT version. He vomited some of the functions in the new version.
Your version of plugin works fine with the 0.19.2 version. But I am
working on 0.19.11 version :-(. So I have to make changes to your code so
that it might work with the new version of ElasticSearch. Thanks for the
reply :slight_smile:

On Tuesday, November 27, 2012 4:58:00 PM UTC+5:30, Tanguy wrote:

Hey,

Do you see log messages confirming that the zeromq plugin is listening
for incoming message?

Do you check if a firewall is blocking port 9700?

Since this plugin is not part of elasticsearch core, you can move on
https://github.com/tlrx/transport-zeromq/issues to report any bugs.

-- Tanguy

Le mardi 27 novembre 2012 10:40:26 UTC+1, Vinay Gurram a écrit :

Hi,

I changed to 0.19.10 version of elastic search, 2.2 version of
ZeroMQ and 0.0.4 SNAPSHOT version of zeroMq transport plugin (
https://github.com/bpaquet/transport-zeromq). I am not able to run
the java SimpleClient in the test package in the github package. The client
was able to send the message but couldn't receive the message from
ElasticSearch. Java program stops at the line where socket.recv function
called. I am thinking that it's waiting for the reply and could not receive
the message.

Simple Client ::
//Format function to append the message in the proper format
private static byte[] format(String method, String url, String
json, Integer count) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder(method);
sb.append(ZMQSocket.SEPARATOR);
if (count != null) {
sb.append(url).append(count);
} else {
sb.append(url);
}
sb.append(ZMQSocket.SEPARATOR);

if (json != null) {
sb.append(json);
}
return sb.toString().getBytes("UTF-8");
}
public static void main(String[] args) throws IOException {
final ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket socket = context.socket(ZMQ.DEALER);
socket.connect(address);
socket.send(format(method, url, json, null), 0);

byte[] response =
socket.recv(0);//////////////////////////////////////At this line Java
Program stops
System.out.println(response);
}

      finally {

try {
socket.close();
} catch (Exception e2) {
// ignore
}
try {
context.term();
} catch (Exception e2) {
// ignore
}

System.out.printf("%d message(s) sent in %dms", repeat,
System.currentTimeMillis()-startTime);
}

Ononday, November 26, 2012 1:53:07 PM UTC+5:30, Tanguy wrote:

Hi Vinay,

Did you install zeromq and the plugin on every hosts? Which version
of zeromq do you use? Which OS?

-- Tanguy

Le lundi 26 novembre 2012 08:24:22 UTC+1, Vinay Gurram a écrit :

Have anyone worked with zeromq plugin for elasticserach?
I tried to run SimpleClient provided by the github package, but
couldn't post message on ElasticSearch. Can anyone provide a working
example code?

--