How to implement a Sitecore Commerce Minion

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I am new to Sitecore commerce Minions.



I wanted to create a Minion which runs for every 30 minutes to update the Product values.



I am getting the Products properties from external source.



What changes do I need to make ?







share|improve this question

























    up vote
    2
    down vote

    favorite












    I am new to Sitecore commerce Minions.



    I wanted to create a Minion which runs for every 30 minutes to update the Product values.



    I am getting the Products properties from external source.



    What changes do I need to make ?







    share|improve this question























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I am new to Sitecore commerce Minions.



      I wanted to create a Minion which runs for every 30 minutes to update the Product values.



      I am getting the Products properties from external source.



      What changes do I need to make ?







      share|improve this question













      I am new to Sitecore commerce Minions.



      I wanted to create a Minion which runs for every 30 minutes to update the Product values.



      I am getting the Products properties from external source.



      What changes do I need to make ?









      share|improve this question












      share|improve this question




      share|improve this question








      edited Aug 9 at 17:32









      Pratik Wasnik

      15511




      15511









      asked Aug 6 at 8:46









      Hussain

      524




      524




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          First of all you need to declare your minion on the environment definition for your minions environment.



          In the Sitecore.Commerce.Engine project is the JSON file PlugIn.Habitat.CommerceMinions-1.0.0.json which is the definition for the habitat minions environment. This is the active environment on the commerce minions web site (one of 4 in IIS installed as part of commerce).



          First of all you need to declare your minion in a json :




          "$type": "Sitecore.Commerce.Core.MinionPolicy, Sitecore.Commerce.Core",
          "WakeupInterval": "00:05:00",
          "ListToWatch": "",
          "FullyQualifiedName": "Plugin.MyProject.Import.ImportMinion, Plugin.MyProject.Import",
          "ItemsPerBatch": 10,
          "SleepBetweenBatches": 500



          You need to declare your class which inherits from Minion class



           namespace Plugin.MyProject.Import

          public class ImportMinion : Minion

          protected IImportMinionMinionPipeline MinionPipeline get; set;

          public override void Initialize(IServiceProvider serviceProvider, ILogger logger, MinionPolicy policy, CommerceEnvironment environment, CommerceContext globalContext)

          base.Initialize(serviceProvider, logger, policy, environment, globalContext);
          MinionPipeline = serviceProvider.GetService<IImportMinionMinionPipeline>();


          public override async Task<MinionRunResultsModel> Run()

          this.Logger.LogInformation("ImportMinion running");

          var commerceContext = new CommerceContext(this.Logger, this.MinionContext.TelemetryClient, null);
          commerceContext.Environment = this.Environment;

          CommercePipelineExecutionContextOptions executionContextOptions = new CommercePipelineExecutionContextOptions(commerceContext, null, null, null, null, null);

          MinionRunResultsModel res = await this.MinionPipeline.Run(new MinionRunResultsModel(), executionContextOptions);

          return new MinionRunResultsModel();





          Because of the changes in the json files you need to bootrastrap your commerce engine.



          Please have a look for more informations on next links :



          https://blog.ryanbailey.co.nz/2018/03/sitecore-experience-commerce-creating.html
          https://blog.ryanbailey.co.nz/2018/05/sitecore-experience-commerce-minion-to.html
          https://github.com/commerceengineplugins/sampleminion






          share|improve this answer





















          • I tried to hit the Minion from Postman and i got the below error. "MessageDate":"2018-08-08T08:32:41.4097457Z","Code":"Error","Text":"Minion Sitecore.Commerce.Plugin.SAP.Minion.SAPProductSyncMinion, Sitecore.Commerce.Plugin.SAP was not found.","CommerceTermKey":"MinionNotFound"
            – Hussain
            Aug 8 at 8:40











          • did you bootstrap your commerce engine?
            – Vlad Iobagiu
            Aug 8 at 9:21










          • HI Vlad, Yes I did. I am getting the below error in "CommerceMinions" IIS website log file.[MinionStartup] Environment='HabitatMinions', 'Sitecore.Commerce.Plugin.SAP.Minion, Sitecore.Commerce.Plugin.SAP' 11 05:17:38 ERROR Pipeline completed with error System.Exception: Error processing block: Core.block.StartEnvironmentMinions ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null
            – Hussain
            Aug 8 at 9:32











          • The problem with wrong assembly name added in Minion config file. Now this is working as expected.
            – Hussain
            Aug 9 at 6:29










          • Great, glad I could help you
            – Vlad Iobagiu
            Aug 9 at 6:32










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "664"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f13196%2fhow-to-implement-a-sitecore-commerce-minion%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          First of all you need to declare your minion on the environment definition for your minions environment.



          In the Sitecore.Commerce.Engine project is the JSON file PlugIn.Habitat.CommerceMinions-1.0.0.json which is the definition for the habitat minions environment. This is the active environment on the commerce minions web site (one of 4 in IIS installed as part of commerce).



          First of all you need to declare your minion in a json :




          "$type": "Sitecore.Commerce.Core.MinionPolicy, Sitecore.Commerce.Core",
          "WakeupInterval": "00:05:00",
          "ListToWatch": "",
          "FullyQualifiedName": "Plugin.MyProject.Import.ImportMinion, Plugin.MyProject.Import",
          "ItemsPerBatch": 10,
          "SleepBetweenBatches": 500



          You need to declare your class which inherits from Minion class



           namespace Plugin.MyProject.Import

          public class ImportMinion : Minion

          protected IImportMinionMinionPipeline MinionPipeline get; set;

          public override void Initialize(IServiceProvider serviceProvider, ILogger logger, MinionPolicy policy, CommerceEnvironment environment, CommerceContext globalContext)

          base.Initialize(serviceProvider, logger, policy, environment, globalContext);
          MinionPipeline = serviceProvider.GetService<IImportMinionMinionPipeline>();


          public override async Task<MinionRunResultsModel> Run()

          this.Logger.LogInformation("ImportMinion running");

          var commerceContext = new CommerceContext(this.Logger, this.MinionContext.TelemetryClient, null);
          commerceContext.Environment = this.Environment;

          CommercePipelineExecutionContextOptions executionContextOptions = new CommercePipelineExecutionContextOptions(commerceContext, null, null, null, null, null);

          MinionRunResultsModel res = await this.MinionPipeline.Run(new MinionRunResultsModel(), executionContextOptions);

          return new MinionRunResultsModel();





          Because of the changes in the json files you need to bootrastrap your commerce engine.



          Please have a look for more informations on next links :



          https://blog.ryanbailey.co.nz/2018/03/sitecore-experience-commerce-creating.html
          https://blog.ryanbailey.co.nz/2018/05/sitecore-experience-commerce-minion-to.html
          https://github.com/commerceengineplugins/sampleminion






          share|improve this answer





















          • I tried to hit the Minion from Postman and i got the below error. "MessageDate":"2018-08-08T08:32:41.4097457Z","Code":"Error","Text":"Minion Sitecore.Commerce.Plugin.SAP.Minion.SAPProductSyncMinion, Sitecore.Commerce.Plugin.SAP was not found.","CommerceTermKey":"MinionNotFound"
            – Hussain
            Aug 8 at 8:40











          • did you bootstrap your commerce engine?
            – Vlad Iobagiu
            Aug 8 at 9:21










          • HI Vlad, Yes I did. I am getting the below error in "CommerceMinions" IIS website log file.[MinionStartup] Environment='HabitatMinions', 'Sitecore.Commerce.Plugin.SAP.Minion, Sitecore.Commerce.Plugin.SAP' 11 05:17:38 ERROR Pipeline completed with error System.Exception: Error processing block: Core.block.StartEnvironmentMinions ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null
            – Hussain
            Aug 8 at 9:32











          • The problem with wrong assembly name added in Minion config file. Now this is working as expected.
            – Hussain
            Aug 9 at 6:29










          • Great, glad I could help you
            – Vlad Iobagiu
            Aug 9 at 6:32














          up vote
          2
          down vote



          accepted










          First of all you need to declare your minion on the environment definition for your minions environment.



          In the Sitecore.Commerce.Engine project is the JSON file PlugIn.Habitat.CommerceMinions-1.0.0.json which is the definition for the habitat minions environment. This is the active environment on the commerce minions web site (one of 4 in IIS installed as part of commerce).



          First of all you need to declare your minion in a json :




          "$type": "Sitecore.Commerce.Core.MinionPolicy, Sitecore.Commerce.Core",
          "WakeupInterval": "00:05:00",
          "ListToWatch": "",
          "FullyQualifiedName": "Plugin.MyProject.Import.ImportMinion, Plugin.MyProject.Import",
          "ItemsPerBatch": 10,
          "SleepBetweenBatches": 500



          You need to declare your class which inherits from Minion class



           namespace Plugin.MyProject.Import

          public class ImportMinion : Minion

          protected IImportMinionMinionPipeline MinionPipeline get; set;

          public override void Initialize(IServiceProvider serviceProvider, ILogger logger, MinionPolicy policy, CommerceEnvironment environment, CommerceContext globalContext)

          base.Initialize(serviceProvider, logger, policy, environment, globalContext);
          MinionPipeline = serviceProvider.GetService<IImportMinionMinionPipeline>();


          public override async Task<MinionRunResultsModel> Run()

          this.Logger.LogInformation("ImportMinion running");

          var commerceContext = new CommerceContext(this.Logger, this.MinionContext.TelemetryClient, null);
          commerceContext.Environment = this.Environment;

          CommercePipelineExecutionContextOptions executionContextOptions = new CommercePipelineExecutionContextOptions(commerceContext, null, null, null, null, null);

          MinionRunResultsModel res = await this.MinionPipeline.Run(new MinionRunResultsModel(), executionContextOptions);

          return new MinionRunResultsModel();





          Because of the changes in the json files you need to bootrastrap your commerce engine.



          Please have a look for more informations on next links :



          https://blog.ryanbailey.co.nz/2018/03/sitecore-experience-commerce-creating.html
          https://blog.ryanbailey.co.nz/2018/05/sitecore-experience-commerce-minion-to.html
          https://github.com/commerceengineplugins/sampleminion






          share|improve this answer





















          • I tried to hit the Minion from Postman and i got the below error. "MessageDate":"2018-08-08T08:32:41.4097457Z","Code":"Error","Text":"Minion Sitecore.Commerce.Plugin.SAP.Minion.SAPProductSyncMinion, Sitecore.Commerce.Plugin.SAP was not found.","CommerceTermKey":"MinionNotFound"
            – Hussain
            Aug 8 at 8:40











          • did you bootstrap your commerce engine?
            – Vlad Iobagiu
            Aug 8 at 9:21










          • HI Vlad, Yes I did. I am getting the below error in "CommerceMinions" IIS website log file.[MinionStartup] Environment='HabitatMinions', 'Sitecore.Commerce.Plugin.SAP.Minion, Sitecore.Commerce.Plugin.SAP' 11 05:17:38 ERROR Pipeline completed with error System.Exception: Error processing block: Core.block.StartEnvironmentMinions ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null
            – Hussain
            Aug 8 at 9:32











          • The problem with wrong assembly name added in Minion config file. Now this is working as expected.
            – Hussain
            Aug 9 at 6:29










          • Great, glad I could help you
            – Vlad Iobagiu
            Aug 9 at 6:32












          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          First of all you need to declare your minion on the environment definition for your minions environment.



          In the Sitecore.Commerce.Engine project is the JSON file PlugIn.Habitat.CommerceMinions-1.0.0.json which is the definition for the habitat minions environment. This is the active environment on the commerce minions web site (one of 4 in IIS installed as part of commerce).



          First of all you need to declare your minion in a json :




          "$type": "Sitecore.Commerce.Core.MinionPolicy, Sitecore.Commerce.Core",
          "WakeupInterval": "00:05:00",
          "ListToWatch": "",
          "FullyQualifiedName": "Plugin.MyProject.Import.ImportMinion, Plugin.MyProject.Import",
          "ItemsPerBatch": 10,
          "SleepBetweenBatches": 500



          You need to declare your class which inherits from Minion class



           namespace Plugin.MyProject.Import

          public class ImportMinion : Minion

          protected IImportMinionMinionPipeline MinionPipeline get; set;

          public override void Initialize(IServiceProvider serviceProvider, ILogger logger, MinionPolicy policy, CommerceEnvironment environment, CommerceContext globalContext)

          base.Initialize(serviceProvider, logger, policy, environment, globalContext);
          MinionPipeline = serviceProvider.GetService<IImportMinionMinionPipeline>();


          public override async Task<MinionRunResultsModel> Run()

          this.Logger.LogInformation("ImportMinion running");

          var commerceContext = new CommerceContext(this.Logger, this.MinionContext.TelemetryClient, null);
          commerceContext.Environment = this.Environment;

          CommercePipelineExecutionContextOptions executionContextOptions = new CommercePipelineExecutionContextOptions(commerceContext, null, null, null, null, null);

          MinionRunResultsModel res = await this.MinionPipeline.Run(new MinionRunResultsModel(), executionContextOptions);

          return new MinionRunResultsModel();





          Because of the changes in the json files you need to bootrastrap your commerce engine.



          Please have a look for more informations on next links :



          https://blog.ryanbailey.co.nz/2018/03/sitecore-experience-commerce-creating.html
          https://blog.ryanbailey.co.nz/2018/05/sitecore-experience-commerce-minion-to.html
          https://github.com/commerceengineplugins/sampleminion






          share|improve this answer













          First of all you need to declare your minion on the environment definition for your minions environment.



          In the Sitecore.Commerce.Engine project is the JSON file PlugIn.Habitat.CommerceMinions-1.0.0.json which is the definition for the habitat minions environment. This is the active environment on the commerce minions web site (one of 4 in IIS installed as part of commerce).



          First of all you need to declare your minion in a json :




          "$type": "Sitecore.Commerce.Core.MinionPolicy, Sitecore.Commerce.Core",
          "WakeupInterval": "00:05:00",
          "ListToWatch": "",
          "FullyQualifiedName": "Plugin.MyProject.Import.ImportMinion, Plugin.MyProject.Import",
          "ItemsPerBatch": 10,
          "SleepBetweenBatches": 500



          You need to declare your class which inherits from Minion class



           namespace Plugin.MyProject.Import

          public class ImportMinion : Minion

          protected IImportMinionMinionPipeline MinionPipeline get; set;

          public override void Initialize(IServiceProvider serviceProvider, ILogger logger, MinionPolicy policy, CommerceEnvironment environment, CommerceContext globalContext)

          base.Initialize(serviceProvider, logger, policy, environment, globalContext);
          MinionPipeline = serviceProvider.GetService<IImportMinionMinionPipeline>();


          public override async Task<MinionRunResultsModel> Run()

          this.Logger.LogInformation("ImportMinion running");

          var commerceContext = new CommerceContext(this.Logger, this.MinionContext.TelemetryClient, null);
          commerceContext.Environment = this.Environment;

          CommercePipelineExecutionContextOptions executionContextOptions = new CommercePipelineExecutionContextOptions(commerceContext, null, null, null, null, null);

          MinionRunResultsModel res = await this.MinionPipeline.Run(new MinionRunResultsModel(), executionContextOptions);

          return new MinionRunResultsModel();





          Because of the changes in the json files you need to bootrastrap your commerce engine.



          Please have a look for more informations on next links :



          https://blog.ryanbailey.co.nz/2018/03/sitecore-experience-commerce-creating.html
          https://blog.ryanbailey.co.nz/2018/05/sitecore-experience-commerce-minion-to.html
          https://github.com/commerceengineplugins/sampleminion







          share|improve this answer













          share|improve this answer



          share|improve this answer











          answered Aug 6 at 8:56









          Vlad Iobagiu

          10.9k2628




          10.9k2628











          • I tried to hit the Minion from Postman and i got the below error. "MessageDate":"2018-08-08T08:32:41.4097457Z","Code":"Error","Text":"Minion Sitecore.Commerce.Plugin.SAP.Minion.SAPProductSyncMinion, Sitecore.Commerce.Plugin.SAP was not found.","CommerceTermKey":"MinionNotFound"
            – Hussain
            Aug 8 at 8:40











          • did you bootstrap your commerce engine?
            – Vlad Iobagiu
            Aug 8 at 9:21










          • HI Vlad, Yes I did. I am getting the below error in "CommerceMinions" IIS website log file.[MinionStartup] Environment='HabitatMinions', 'Sitecore.Commerce.Plugin.SAP.Minion, Sitecore.Commerce.Plugin.SAP' 11 05:17:38 ERROR Pipeline completed with error System.Exception: Error processing block: Core.block.StartEnvironmentMinions ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null
            – Hussain
            Aug 8 at 9:32











          • The problem with wrong assembly name added in Minion config file. Now this is working as expected.
            – Hussain
            Aug 9 at 6:29










          • Great, glad I could help you
            – Vlad Iobagiu
            Aug 9 at 6:32
















          • I tried to hit the Minion from Postman and i got the below error. "MessageDate":"2018-08-08T08:32:41.4097457Z","Code":"Error","Text":"Minion Sitecore.Commerce.Plugin.SAP.Minion.SAPProductSyncMinion, Sitecore.Commerce.Plugin.SAP was not found.","CommerceTermKey":"MinionNotFound"
            – Hussain
            Aug 8 at 8:40











          • did you bootstrap your commerce engine?
            – Vlad Iobagiu
            Aug 8 at 9:21










          • HI Vlad, Yes I did. I am getting the below error in "CommerceMinions" IIS website log file.[MinionStartup] Environment='HabitatMinions', 'Sitecore.Commerce.Plugin.SAP.Minion, Sitecore.Commerce.Plugin.SAP' 11 05:17:38 ERROR Pipeline completed with error System.Exception: Error processing block: Core.block.StartEnvironmentMinions ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null
            – Hussain
            Aug 8 at 9:32











          • The problem with wrong assembly name added in Minion config file. Now this is working as expected.
            – Hussain
            Aug 9 at 6:29










          • Great, glad I could help you
            – Vlad Iobagiu
            Aug 9 at 6:32















          I tried to hit the Minion from Postman and i got the below error. "MessageDate":"2018-08-08T08:32:41.4097457Z","Code":"Error","Text":"Minion Sitecore.Commerce.Plugin.SAP.Minion.SAPProductSyncMinion, Sitecore.Commerce.Plugin.SAP was not found.","CommerceTermKey":"MinionNotFound"
          – Hussain
          Aug 8 at 8:40





          I tried to hit the Minion from Postman and i got the below error. "MessageDate":"2018-08-08T08:32:41.4097457Z","Code":"Error","Text":"Minion Sitecore.Commerce.Plugin.SAP.Minion.SAPProductSyncMinion, Sitecore.Commerce.Plugin.SAP was not found.","CommerceTermKey":"MinionNotFound"
          – Hussain
          Aug 8 at 8:40













          did you bootstrap your commerce engine?
          – Vlad Iobagiu
          Aug 8 at 9:21




          did you bootstrap your commerce engine?
          – Vlad Iobagiu
          Aug 8 at 9:21












          HI Vlad, Yes I did. I am getting the below error in "CommerceMinions" IIS website log file.[MinionStartup] Environment='HabitatMinions', 'Sitecore.Commerce.Plugin.SAP.Minion, Sitecore.Commerce.Plugin.SAP' 11 05:17:38 ERROR Pipeline completed with error System.Exception: Error processing block: Core.block.StartEnvironmentMinions ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null
          – Hussain
          Aug 8 at 9:32





          HI Vlad, Yes I did. I am getting the below error in "CommerceMinions" IIS website log file.[MinionStartup] Environment='HabitatMinions', 'Sitecore.Commerce.Plugin.SAP.Minion, Sitecore.Commerce.Plugin.SAP' 11 05:17:38 ERROR Pipeline completed with error System.Exception: Error processing block: Core.block.StartEnvironmentMinions ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null
          – Hussain
          Aug 8 at 9:32













          The problem with wrong assembly name added in Minion config file. Now this is working as expected.
          – Hussain
          Aug 9 at 6:29




          The problem with wrong assembly name added in Minion config file. Now this is working as expected.
          – Hussain
          Aug 9 at 6:29












          Great, glad I could help you
          – Vlad Iobagiu
          Aug 9 at 6:32




          Great, glad I could help you
          – Vlad Iobagiu
          Aug 9 at 6:32












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f13196%2fhow-to-implement-a-sitecore-commerce-minion%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What is the equation of a 3D cone with generalised tilt?

          Color the edges and diagonals of a regular polygon

          Relationship between determinant of matrix and determinant of adjoint?