Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MOSIP-8576] task executor props change. callback url to birthCallbac… #3

Merged
merged 1 commit into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class AppInitConfig{

@EventListener(ApplicationReadyEvent.class)
public void init() throws BaseCheckedException{
if(env.getProperty("opencrvs.subscribe.startup").equals("true")){
if("true".equals(env.getProperty("opencrvs.subscribe.startup"))){
try{
String res = restUtil.webhooksSubscribe();
// if(res!="Success"){LOGGER.error(LoggingConstants.SESSION, LoggingConstants.ID, "ROOT", "Unable to subscribe to opencrvs, response: "+res);}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public class BeanConfig{
@Bean
public Executor taskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(Integer.parseInt(env.getProperty("receiver.core.pool.size")));
executor.setMaxPoolSize(Integer.parseInt(env.getProperty("receiver.max.pool.size")));
executor.setQueueCapacity(Integer.parseInt(env.getProperty("receiver.queue.capacity")));
executor.setCorePoolSize(Integer.parseInt(env.getProperty("mediator.core.pool.size")));
executor.setMaxPoolSize(Integer.parseInt(env.getProperty("mediator.max.pool.size")));
executor.setQueueCapacity(Integer.parseInt(env.getProperty("mediator.queue.capacity")));
executor.setThreadNamePrefix("Mediator-");
executor.initialize();
return executor;
Expand Down
4 changes: 2 additions & 2 deletions mediator/src/main/java/io/mosip/opencrvs/util/RestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public String webhooksSubscribe() throws Exception{
String opencrvsClientShaSecret = env.getProperty("opencrvs.client.sha.secret");
String opencrvsAuthUrl = env.getProperty("opencrvs.auth.url");
String opencrvsWebhooksUrl = env.getProperty("opencrvs.webhooks.url");
String opencrvsCallbackUrl = env.getProperty("opencrvs.callback.url");
String opencrvsBirthCallbackUrl = env.getProperty("opencrvs.birth.callback.url");

RestTemplate restTemplate = new RestTemplate();
HttpHeaders requestHeaders = new HttpHeaders();
Expand All @@ -168,7 +168,7 @@ public String webhooksSubscribe() throws Exception{
requestHeaders = new HttpHeaders();
requestHeaders.setContentType(MediaType.APPLICATION_JSON);
requestHeaders.set("Authorization","Bearer "+token);
request = new HttpEntity<>("{\"hub\":{\"callback\":\""+ opencrvsCallbackUrl +"\",\"mode\":\"subscribe\",\"secret\":\""+ opencrvsClientShaSecret +"\",\"topic\":\"BIRTH_REGISTERED\"}}",requestHeaders);
request = new HttpEntity<>("{\"hub\":{\"callback\":\""+ opencrvsBirthCallbackUrl +"\",\"mode\":\"subscribe\",\"secret\":\""+ opencrvsClientShaSecret +"\",\"topic\":\"BIRTH_REGISTERED\"}}",requestHeaders);
try{responseForRequest = restTemplate.postForEntity(opencrvsWebhooksUrl, request, String.class);}
catch(RestClientException e){
throw new Exception(ErrorCode.SUBSCRIBE_FAILED_EXCEPTION);
Expand Down
8 changes: 4 additions & 4 deletions mediator/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
receiver.core.pool.size=2
receiver.max.pool.size=2
receiver.queue.capacity=500
mediator.core.pool.size=2
mediator.max.pool.size=2
mediator.queue.capacity=500

opencrvs.datetime.pattern=yyyy-MM-dd'T'HH:mm:ss.SSS'Z'

Expand All @@ -22,8 +22,8 @@ opencrvs.data.dummy.zone="[{\"language\":\"eng\",\"value\":\"Ben Mansour\"}]"
opencrvs.data.dummy.postal.code="[{\"language\":\"eng\",\"value\":\"14022\"}]"
# opencrvs.subscribe.startup=false
# opecnrvs.auth.url=
# opencrvs.callback.url=
# opencrvs.webhooks.url=
# opencrvs.birth.callback.url=
# opencrvs.client.id=mosip-opencrvs-client
# opencrvs.client.id=mosip-regproc-client
# opencrvs.client.secret.key=abc123
Expand Down