Cron jobs with Expression Engine 2? - cron

I'm developing an Expression Engine site. The site has a database table populated from an external feed, and this feed needs to be parsed twice daily.
Obviously, a cron job seems a good fit for this, but where I'm struggling is, where do I put the code for this? I want to use the EE framework, and have the cron job hit a URL, but I don't really want to create a template just to drop some Expression Engine template tags into in order to run an action.
Is there an alternative way to create a script that I can use the Expression Engine core, but not have to create a template and template tag for it?

EE doesn't have an internal faux-cron process you can hook into, but there is a first-party add-on that can do the trick. The thing is, it requires a plugin method or module class and module method be passed to it, not a URL. So, you'd have to write a quick plugin that, when executed, calls your action URL via cURL or what-have-you.
On the commercial side, there's the $35 Automat:ee module that can hit a URL in a simulated cron job.

Related

How to create low code based workflow setup in nodejs?

I want to create a workflow automation where an activity comes in and user can setup a multilevel workflow.
For frontend i am using https://reactflow.dev
How to structure things in nodejs backend. Things like database, accessing control flow statements, statements which requires crons.
You also may want to have a look at node-red.
It's an open-source product that does exactly that.
There's a set of built-in nodes.
You can develop your own nodes, or import 3rd party ones. Which are stored in NPM.
You can also just create a node with javascript or typescript code in it, on the fly.
You should check Flumejs: https://flume.dev/
https://flume.dev/docs/quick-start/
Also you should see this code sandbox example. Try to read the code
and all the dependencies: https://codesandbox.io/s/node-based-code-generation-test-forked-ll9flz?file=/src/App.tsx
I hope you find this helpful.

Post Service call with Multiple records

I would like to know how to post multiple records to SAP using "BatchRequestBuilder" along with ChangeSet .I am using a custom odata service call(ODataCreateRequestBuilder),not using the VDM model. I did'nt get any blog or documentation to start with.
Can you please help me in this regard.
Updated:
Below is what I am trying to post to SAP
[{"purchaseSchAgrmntNo":"","customerMaterialNumber":"","plant":"","vendorNo":""},{"purchaseSchAgrmntNo":"","customerMaterialNumber":"","plant":"","vendorNo":""}]
SAP SDK version : 3.9.0
I have added below code with only one CreateRequest.
ChangeSet changeSet = new ChangeSetBuilder().addCreateRequest( ODataCreateRequestBuilder.withEntity(sapConfig.getServiceUrlRepriceList(),
sapConfig.getEntityRepriceList())
.withBodyAsMap(responseBody)
.build()).build();
BatchResult batchResult = BatchRequestBuilder.withService("URL?").addChangeSet(changeSet).build().execute(httpClient);
Can you let me know if this is correct.Also let me know what I have to pass in the service.Is it service URL?
Thanks,
Arun Pai
The BatchRequestBuilder is actually not directly part of the SAP Cloud SDK but a dependency that the SDK internally uses to execute batch requests. That is why on the SDK level there is no documentation on how to use it.
Roughly, a batch request comprises of multiple change sets which in turn group together multiple operations. The ChangeSetBuilder allows you to build up change sets which you can then pass to a BatchRequestBuilder.
So if you want to run create requests in batch mode you would want to leverage public ChangeSetBuilder addCreateRequest(ODataCreateRequest oDataCreateRequest).
You can take a look at how the SAP Cloud SDK uses these classes to build up batch requests to get an idea how it works in detail. As a starting point look towards BatchFluentHelperBasic. However, unless you don't know the service you want to query at compile time, I recommend that you leverage the generator to generate this code so that you can use the VDM instead which simplifies this.
If you extend your question to hold more specific information on what you actually want to achieve I can expand my answer to give a more concrete example. Also please include the SDK version you are using.

Use TemplateContext instead of TemplateContext?

I just upgraded my project from ServiceStack 5.1 to 5.5.1. Now where I am using TemplateContext from ServiceStack.Templates it tells instead to use TemplateContext. Needless to say, this is likely a mistake in the description for the Obsolete attribute. What is the appropiate replacement for TemplateContext now in ServiceStack 5.5.1?
The depreciation message should’ve said to use ScriptContext instead.
In the latest ServiceStack v5.5 Release ServiceStack Templates has been rebranded to #Script.
The section on Migration to new Script API's explains how to migrate in more detail:
Migrating to the new APIs is fairly straight forward:
Change using ServiceStack.Templates; to using ServiceStack.Script;
Any classes with TemplatePage* has been renamed to SharpPage*
Any other class with a Template* prefix has been renamed to Script*
This change doesn’t affect any of your existing #Script source code whose existing syntax and available filters/methods remains unchanged.
New Terminology
The primary rationale for the rebranding was so we’re better able to label, describe and document all of #Script different features easier, so when referring to Templates View Engine we’re now calling Sharp Pages which is a better corollary to “Razor Pages” which it provides an alternative to.
Other re-branded features:
API Pages are now called Sharp APIs
Web Apps are now called Sharp Apps
Template Filters are now called Script Methods
Template Blocks are now called Script Blocks
The collection of methods you inject in your scripts like TemplateRedisFilters and TemplateDbFilters are now referred to as “Scripts” where they’ve been renamed to RedisScripts and DbScripts.

What all do i need for using drools with spark for managing rules?

I have to set some filtering conditions base on business given values. I am thinking of using drools for this but the documentation is very complex and has too many components. Which components do i need to use drools as rules engine. My understanding is that i need drools engine which is the core part and drools workbench which is a GUI to set rules I also have KIE execution server deployed on tomcat server but do i need this?. Is this correct do i need anything else?
If you can define your business rules as part of the source code then you can simply embed the Drools engine in one of the jars included with your Spark job. You'll simply need to include drools-core, drools-compiler, kie-api, and kie-internal in your dependencies.
If you need your business people to author these rules, or the rules need to be able to be redeployed without rebuilding/redeploying the application, then you will need the workbench.
I installed kie-server and kie-workbench.
kie-workbench is a UI and allows following
1. Creation of a project/container
2. creation of rule or guided rule
3. creation of data objects which are like POJO objects.
4. deploy created project/container to kie-server
5. and also lot of other things which i did not explore.
kie-server is component which
1. accepts REST requests to manage or execute containers
I created required rules in kie-wb and deployed them onto kie-server and then made rest requests to kie-server from my program and received xml response after all rules are executed.
I followed the following links
http://www.mastertheboss.com/jboss-jbpm/jbpm6/running-rules-on-wildfly-with-kie-server
http://mswiderski.blogspot.in/2015/10/installing-kie-server-and-workbench-on.html

How to get CC.net build status for a project programatically?

From a shell script, I want to detect if CC.net is currently building a project. I have the URL of the CC.net server and the name of the project.
Heck, to make it easier, I'm running this on the CC.net server itself! So any kind of local-process querying is fine.
I know I can grab the status page as HTML, and then grep that or something, but it seems awkward (especially as this is Windows). Is there an easier way?
Yes, if you don't mind writing some code you should be able to write a wrapper around ThoughtWorks.CruiseControl.Remote.dll if you poke around the source for CCTray you'll see that it is calling ICruiseManager.GetProjectStatus() which will give you a ProjectStatus array containing each of the active projects, from there you should have all you need.

Resources