Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-1732

Refactor swatch-subscription-sync Job to use curl and internal endpoint

XMLWordPrintable

      The swatch-subscription-sync job is defined in the clowdapp.yaml file as a cronjob.

      However, this job will start the Swatch Tally service using the profiles "subscription-sync" and "kafka-queue" (see here).

      The relevant profile here is "subscription-sync" which will make the Tally service to act as a command line program to execute the SubscriptionSyncJob task which does:

      if (!applicationProperties.isSubscriptionSyncEnabled()) {
            log.info(
                "Will not sync subscriptions for all opted-in orgs even though job was scheduled because subscriptionSyncEnabled=false.");
            return;
          }
      
          try {
            controller.syncAllSubscriptionsForAllOrgs();
          } catch (Exception e) {
            throw new JobFailureException("Failed to run " + this.getClass().getSimpleName(), e);
          }
      

      The same method is invoked by calling the endpoint "/rpc/subscriptions/sync".

      Acceptance Criteria:

      • Modify the "sync" job in clowdapp.yaml to invoke the "/rpc/subscriptions/sync" if and only if "${SUBSCRIPTION_SYNC_ENABLED}" is true. (As an example, the "purge" job is already invoking another endpoint here).
      • Delete the spring profile "subscription-sync" since it should not be used any longer (ensure "SubscriptionSyncController" is properly imported when running the swatch tally service).
      • Delete SubscriptionSyncConfiguration, SubscriptionSyncJob
      • Update the diagram to remove the deleted profile

            jcarvaja@redhat.com Jose Carvajal Hilario
            jcarvaja@redhat.com Jose Carvajal Hilario
            Sumedh Sidhaye Sumedh Sidhaye
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: