Custom cluster action

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom cluster action

Paweł Róg
Hi,
I'm thinking about building custom ClusterAction. I see that I can build custom classes for Request, NodeResponse and NodesRespone but it is not clear to me how I can register my custom action.

In case of Rest action it was quite easy because in plugin i simply use

    public void onModule(RestModule module) {
        module.addRestAction(RestCustomAction.class);
    }

but I cannot find any examples how I can do this in case of custom ClusterAction.

Does anybody have any example how I can achieve this? Thanks for your help.

--
Paweł Róg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom cluster action

Ivan Brusic
There is also an ActionModule

public void onModule(ActionModule module) {
    module.registerAction(MyAction.INSTANCE, TransportMyAction.class);
}

It is always easier to follow existing plugins.

Cheers,

Ivan

On Wed, Nov 12, 2014 at 3:50 PM, Pawel <[hidden email]> wrote:
Hi,
I'm thinking about building custom ClusterAction. I see that I can build custom classes for Request, NodeResponse and NodesRespone but it is not clear to me how I can register my custom action.

In case of Rest action it was quite easy because in plugin i simply use

    public void onModule(RestModule module) {
        module.addRestAction(RestCustomAction.class);
    }

but I cannot find any examples how I can do this in case of custom ClusterAction.

Does anybody have any example how I can achieve this? Thanks for your help.

--
Paweł Róg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom cluster action

Paweł Róg
Hi,
Thank you very much :-)

Paweł

On Wed, Nov 12, 2014 at 10:23 PM, Ivan Brusic <[hidden email]> wrote:
There is also an ActionModule

public void onModule(ActionModule module) {
    module.registerAction(MyAction.INSTANCE, TransportMyAction.class);
}

It is always easier to follow existing plugins.

Cheers,

Ivan

On Wed, Nov 12, 2014 at 3:50 PM, Pawel <[hidden email]> wrote:
Hi,
I'm thinking about building custom ClusterAction. I see that I can build custom classes for Request, NodeResponse and NodesRespone but it is not clear to me how I can register my custom action.

In case of Rest action it was quite easy because in plugin i simply use

    public void onModule(RestModule module) {
        module.addRestAction(RestCustomAction.class);
    }

but I cannot find any examples how I can do this in case of custom ClusterAction.

Does anybody have any example how I can achieve this? Thanks for your help.

--
Paweł Róg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPQAoyQZ2drbscN%3DwV-rVXG7r%3DppvHWx%2BdkqrtF%2B_Cwvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom cluster action

Ali Lotfdar
Hi Pawel,

I am new in creating action plugin, and I found you have already work on it. Could you please let me know if there is any sample and explanation which can help me to start.
I already reviewed cookbook ES, but I could not understand its explanation!

Thank you. 


Regards,
Ali

On Thursday, November 13, 2014 at 1:06:00 AM UTC-5, Paweł Róg wrote:
Hi,
Thank you very much :-)

Paweł

On Wed, Nov 12, 2014 at 10:23 PM, Ivan Brusic <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="KX-PxDL2lLoJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">iv...@...> wrote:
There is also an ActionModule

public void onModule(ActionModule module) {
    module.registerAction(MyAction.INSTANCE, TransportMyAction.class);
}

It is always easier to follow existing plugins.

Cheers,

Ivan

On Wed, Nov 12, 2014 at 3:50 PM, Pawel <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="KX-PxDL2lLoJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">pro...@...> wrote:
Hi,
I'm thinking about building custom ClusterAction. I see that I can build custom classes for Request, NodeResponse and NodesRespone but it is not clear to me how I can register my custom action.

In case of Rest action it was quite easy because in plugin i simply use

    public void onModule(RestModule module) {
        module.addRestAction(RestCustomAction.class);
    }

but I cannot find any examples how I can do this in case of custom ClusterAction.

Does anybody have any example how I can achieve this? Thanks for your help.

--
Paweł Róg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="KX-PxDL2lLoJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">elasticsearc...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="KX-PxDL2lLoJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">elasticsearc...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/787c2ad8-ec02-44c2-a8e3-1fc7d3ad6a05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom cluster action

Paweł Róg
Hi Ali,

I used ClusterAction for my  case because I had to execute action on all nodes. I used something like this

public class CustomAction extends
        ClusterAction<CustomRequest, CustomResponse, CustomRequestBuilder>{
... implement all required methods  (override newRequestBuilder and newResponse) ...


public class CustomNodeResponse extends NodeOperationResponse {
}


public class CustomRequest extends NodesOperationRequest<CustomRequest> {
... overide writeTo and readFrom methods ...
... add custom data fields in this class ... (for example I used "id" which was given in constructor and read/write in overridden methods ...

public class CustomRequestBuilder extends
        NodesOperationRequestBuilder<CustomRequest, CustomResponse, CustomRequestBuilder> {
... override doExecute method. I used something below ...
    @Override
    protected void doExecute(ActionListener<CustomResponse> listener) {
        client.execute(CustomAction.INSTANCE, request, listener);
    }


public class CustomResponse extends NodesOperationResponse<NodeCustomResponse> {
... implement writeTo and readFrom methods ...

public class NodeCustomResponse extends NodeOperationResponse {
... implement writeTo and readFrom methods ...


And finally the most important part

public class TransportCustomAction extends  TransportNodesOperationAction<CustomRequest, CustomResponse,
        TransportCustomAction.NodeCustomRequest, NodeCustomResponse> {
... the main part is in     nodeOperation method. here is implementation of your action ...


--
Paweł Róg

On Thursday, March 26, 2015 at 9:26:41 PM UTC+1, Ali Lotfdar wrote:
Hi Pawel,

I am new in creating action plugin, and I found you have already work on it. Could you please let me know if there is any sample and explanation which can help me to start.
I already reviewed cookbook ES, but I could not understand its explanation!

Thank you. 


Regards,
Ali

On Thursday, November 13, 2014 at 1:06:00 AM UTC-5, Paweł Róg wrote:
Hi,
Thank you very much :-)

Paweł

On Wed, Nov 12, 2014 at 10:23 PM, Ivan Brusic <[hidden email]> wrote:
There is also an ActionModule

public void onModule(ActionModule module) {
    module.registerAction(MyAction.INSTANCE, TransportMyAction.class);
}

It is always easier to follow existing plugins.

Cheers,

Ivan

On Wed, Nov 12, 2014 at 3:50 PM, Pawel <[hidden email]> wrote:
Hi,
I'm thinking about building custom ClusterAction. I see that I can build custom classes for Request, NodeResponse and NodesRespone but it is not clear to me how I can register my custom action.

In case of Rest action it was quite easy because in plugin i simply use

    public void onModule(RestModule module) {
        module.addRestAction(RestCustomAction.class);
    }

but I cannot find any examples how I can do this in case of custom ClusterAction.

Does anybody have any example how I can achieve this? Thanks for your help.

--
Paweł Róg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearc...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPoNd4yZLdow_sMJmpN8dr0krEipTX9SbMOp%2BugM0L8_w%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearc...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCTD3ZTreOTPXzd1ifwTqyFj3rzRd8KOsZxs8y6qg-M3Q%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/58822bc2-dfe0-429a-be6c-e372e700396c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.