Forum Stats

  • 3,872,035 Users
  • 2,266,368 Discussions
  • 7,911,029 Comments

Discussions

Triggering a Job based on asset creation event

Mohan Basavarajappa
Mohan Basavarajappa Member Posts: 784
edited Nov 6, 2018 12:09PM in WebCenter Sites

Hi All

Am looking for info on Job creation or how to leverage framework to create schedule or trigger jobs for batch processing. There is job console available in OWCS but couldn't find information on how customizations can be developed or plugged-in. Any pointers will be helpful.

Thanks

Mohan Basavarajappa

Answers

  • BSR
    BSR Member Posts: 123 Blue Ribbon
    edited Nov 1, 2018 3:38AM

    Hi Mohan,

    Probably the job console you are looking at it is related to scheduled publishing which is not what you are looking for. There is no UI console to schedule custom jobs in OWCS. You may want to look at the "System Events" table using Sites Explorer tool. It has following columns (also providing certain values)

    eventname - Any name in context to your need

    type - 1

    enabled - 1

    times - scheduler time in regex format

    target - ContentServer

    params = pagename=<whatever-is-your-target-sitentry-or-template-sitecatalog-pagename-to-invoke>

    Thanks.

    Mohan Basavarajappa
  • Mohan Basavarajappa
    Mohan Basavarajappa Member Posts: 784
    edited Nov 1, 2018 8:26AM

    @BSR

    Are there any events generated when asset translation is done? Or it is generates only asset created event.

  • Graham L
    Graham L Member Posts: 69 Blue Ribbon
    edited Nov 2, 2018 2:14AM

    You could create and AssetEventListener which could check the Dimension-parent variable ics.GetVar("Dimension-parent"), which I believe (have not tested) should be non null if this a translation. I would then add data about the asset to a Queue table such as id, AssetType, timestamp etc and configure a System Event to process the Queue table in a batch.

    Mohan Basavarajappa
  • BSR
    BSR Member Posts: 123 Blue Ribbon
    edited Nov 2, 2018 2:48AM

    Hi Mohan, Graham is right. My above comment answers your actual question about batch job processing in OWCS.

    See this - https://docs.oracle.com/cd/E29542_01/doc.1111/e29634/events_assetapi.htm#WBCSD2525

  • Mohan Basavarajappa
    Mohan Basavarajappa Member Posts: 784
    edited Nov 2, 2018 9:46AM

    @Graham L

    Am aware of the aspect of registering AssetEventListener, thanks for the top on checking the dimension parent variable.

    I didn't the point on Queue table and SystemEvent -  Is this Queue table pre-existing or custom? Couldn't understand about SystemEvent you're referring to.

    Asset creation process is a system event, then what is the additional systemevent which we've to look for?

  • Graham L
    Graham L Member Posts: 69 Blue Ribbon
    edited Nov 2, 2018 11:44AM

    HI Mohan,

    Just a small but import point Asset creation is not a SystemEvent it is an Asset Event. You can think of System Events as cron jobs that are executed in the context of WCS via a SiteCatalog/ElementCatalog pair that executes the logic for your event. These are trigger based on a schedule, like every minute, once a day at 11pm etc. Asset Events on the other handed are not scheduled they happen when an Asset is created, updated or deleted.

    The Queue table is on of your own making. It acts a kind of a message queue where records get inserted when certain asset events happen, which in your case would be translation. Then your SystemEvent would run a the specified schedule and process each row in the Queue table by executing the logic in your element. Once successfully processed they would be either purged from the Queue or their status changed to reflect that they have been processed. This allows you to process things asynchronously so you don't hold up the asset save process.

    This is exactly how search indexing works. When assets are created/updated/deleted the go into a queue table and then each minute a SystemEvent processes them and adds them to the lucene index. That is why their is a little bit of latency between the time an asset is created and when it appears in the index.

    I hope this helps?

  • Mohan Basavarajappa
    Mohan Basavarajappa Member Posts: 784
    edited Nov 6, 2018 7:50AM

    @Graham L

    Do we have documentation on development guidelines and registering SystemEvents (what to develop and where to register) ? My what you mention there must be prescript way of development for this.

  • Graham L
    Graham L Member Posts: 69 Blue Ribbon
    edited Nov 6, 2018 12:09PM

    Hi Mohan,

    BSR has already shared some information on how to register a SystemEvent.

    You can also take a look at this blog post as well. I believe there is some documentation in the Administrators Guide but I cannot locate it right now

    Your Queue table could look something like (Not tested)

    CREATE TABLE TRANSLATED_Q

    (

    "ID" NUMBER(38,0) NOT NULL ENABLE,

    "ASSETTYPE" VARCHAR2(255 BYTE) NOT NULL ENABLE,

    "ASSETID" NUMBER(38,0) NOT NULL ENABLE,

    "ACTION" VARCHAR2(10 BYTE) NOT NULL ENABLE,

    "STATUS" VARCHAR2(4 BYTE),

    "LOCALE" VARCHAR2(100 BYTE),

    "STARTDATE" TIMESTAMP (6),

    "ENDDATE" TIMESTAMP (6),

      PRIMARY KEY ("ID")

    )

    Mohan Basavarajappa