The zookeeper url and the collection name can be fetched by using the rb
(ResponseBuilder
) parameter passed to each of the component's methods:
CoreDescriptor coreDescriptor = rb.req.getCore().getCoreDescriptor();
String collectionName = coreDescriptor.getCloudDescriptor().getCollectionName();
ZkController zkController = coreDescriptor.getCoreContainer().getZkController();
String zookeeperUrl = zkController.getZkServerAddress();
Assuming the custom component class extends SearchComponent
, the rb
parameter is passed to each of the component's public methods: prepare
, process
, distributedProcess
, modifyRequest
, handleResponses
and finishStage
.