Skip to content

Commit

Permalink
Merge pull request #3 from lalithkota/develop
Browse files Browse the repository at this point in the history
[MOSIP-8576] task executor props change. callback url to birthCallbac…
  • Loading branch information
lalithkota authored Mar 18, 2022
2 parents fed7450 + 0b4b1f0 commit 95bf6d7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
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

0 comments on commit 95bf6d7

Please sign in to comment.