-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EPMRPP-82701 || Update Search configs and naming
- Loading branch information
Showing
9 changed files
with
34 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
* @author <a href="mailto:[email protected]">Maksim Antonov</a> | ||
*/ | ||
@Configuration | ||
@ConditionalOnProperty(prefix = "rp.elasticsearch", name = "host") | ||
@ConditionalOnProperty(prefix = "rp.searchengine", name = "host") | ||
public class BackgroundProcessingConfiguration { | ||
|
||
public static final String LOG_MESSAGE_SAVING_QUEUE_NAME = "log_message_saving"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,12 @@ | |
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Empty client to work with Elasticsearch. | ||
* Empty client to work with Search engine. | ||
* | ||
* @author <a href="mailto:[email protected]">Maksim Antonov</a> | ||
*/ | ||
@Service | ||
public class EmptyElasticSearchClient implements ElasticSearchClient { | ||
public class EmptySearchEngineClient implements SearchEngineClient { | ||
|
||
@Override | ||
public void save(List<LogMessage> logMessageList) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,11 @@ | |
import java.util.List; | ||
|
||
/** | ||
* Client interface to work with Elasticsearch. | ||
* Client interface to work with Search engine. | ||
* | ||
* @author <a href="mailto:[email protected]">Maksim Antonov</a> | ||
*/ | ||
public interface ElasticSearchClient { | ||
public interface SearchEngineClient { | ||
|
||
void save(List<LogMessage> logMessageList); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,23 +19,23 @@ | |
import org.springframework.web.client.RestTemplate; | ||
|
||
/** | ||
* Simple client to work with Elasticsearch. | ||
* Simple client to work with Search engine. | ||
* | ||
* @author <a href="mailto:[email protected]">Maksim Antonov</a> | ||
*/ | ||
@Primary | ||
@Service | ||
@ConditionalOnProperty(prefix = "rp.elasticsearch", name = "host") | ||
public class SimpleElasticSearchClient implements ElasticSearchClient { | ||
@ConditionalOnProperty(prefix = "rp.searchengine", name = "host") | ||
public class SimpleSearchEngineClient implements SearchEngineClient { | ||
|
||
protected final Logger LOGGER = LoggerFactory.getLogger(SimpleElasticSearchClient.class); | ||
protected final Logger LOGGER = LoggerFactory.getLogger(SimpleSearchEngineClient.class); | ||
|
||
private final String host; | ||
private final RestTemplate restTemplate; | ||
|
||
public SimpleElasticSearchClient(@Value("${rp.elasticsearch.host}") String host, | ||
@Value("${rp.elasticsearch.username:}") String username, | ||
@Value("${rp.elasticsearch.password:}") String password) { | ||
public SimpleSearchEngineClient(@Value("${rp.searchengine.host}") String host, | ||
@Value("${rp.searchengine.username:}") String username, | ||
@Value("${rp.searchengine.password:}") String password) { | ||
restTemplate = new RestTemplate(); | ||
|
||
if (!username.isEmpty() && !password.isEmpty()) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* @author <a href="mailto:[email protected]">Maksim Antonov</a> | ||
*/ | ||
@Service | ||
@ConditionalOnProperty(prefix = "rp.elasticsearch", name = "host") | ||
@ConditionalOnProperty(prefix = "rp.searchengine", name = "host") | ||
public class SaveLogMessageJob { | ||
|
||
public static final String LOG_MESSAGE_SAVING_QUEUE_NAME = "log_message_saving"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package com.epam.reportportal.log; | ||
|
||
import com.epam.reportportal.calculation.BatchProcessing; | ||
import com.epam.reportportal.elastic.ElasticSearchClient; | ||
import com.epam.reportportal.elastic.SearchEngineClient; | ||
import java.util.List; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
|
@@ -15,22 +15,22 @@ | |
* @author <a href="mailto:[email protected]">Maksim Antonov</a> | ||
*/ | ||
@Component | ||
@ConditionalOnProperty(prefix = "rp.elasticsearch", name = "host") | ||
@ConditionalOnProperty(prefix = "rp.searchengine", name = "host") | ||
public class LogProcessing extends BatchProcessing<LogMessage> { | ||
|
||
private final ElasticSearchClient elasticSearchClient; | ||
private final SearchEngineClient searchEngineClient; | ||
|
||
public LogProcessing(ElasticSearchClient elasticSearchClient, | ||
public LogProcessing(SearchEngineClient searchEngineClient, | ||
@Value("${rp.processing.log.maxBatchSize}") int batchSize, | ||
@Value("${rp.processing.log.maxBatchTimeout}") int timeout) { | ||
super(batchSize, timeout, new DefaultManagedTaskScheduler()); | ||
this.elasticSearchClient = elasticSearchClient; | ||
this.searchEngineClient = searchEngineClient; | ||
} | ||
|
||
@Override | ||
protected void process(List<LogMessage> logMessageList) { | ||
if (!CollectionUtils.isEmpty(logMessageList)) { | ||
elasticSearchClient.save(logMessageList); | ||
searchEngineClient.save(logMessageList); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters