cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

The trigger sequence of the subscription

seanccc
17-Peridot

The trigger sequence of the subscription

Hi, 

How does thingworx manage the sequence of  executing the events ?  For example,  If  raise 100 events in a time , will the subscription be triggered with same sequence of raising event  or  the subscription will be triggered in parallel ? 

 

Regards,

Sean

1 ACCEPTED SOLUTION

Accepted Solutions

It depends on the TW Version, up to what I know:

  • 7.3 and previous, they where executed in-line when where triggered
  • (in between) I don't know in which version in-between they changed the execution logic....
  • 8.4 and above, they are executed asynchronously  by the Event Processor Subsystem, which will use in parallel the amount of Threads you defined on it (by default 16). This text comes directly from R&D: "the internal event queue is an implementation of Java LinkedTransferQueue which has FIFO semantics. However, as long as there are executors available event will start getting executed in parallel (not out of order, events will be pulled in the order they were recieved) but depending on the length of the execution they could complete out of order. (i.e. the second task could finish before the first)"

Hence -> No ordered execution of events if they depend on the result of the others, if your processing subscription algorithm isn't 100% parallelizable you are out of luck.

 

Well, actually it's why I've implemented the Mutex extension  

 

Best Regards

View solution in original post

2 REPLIES 2

It depends on the TW Version, up to what I know:

  • 7.3 and previous, they where executed in-line when where triggered
  • (in between) I don't know in which version in-between they changed the execution logic....
  • 8.4 and above, they are executed asynchronously  by the Event Processor Subsystem, which will use in parallel the amount of Threads you defined on it (by default 16). This text comes directly from R&D: "the internal event queue is an implementation of Java LinkedTransferQueue which has FIFO semantics. However, as long as there are executors available event will start getting executed in parallel (not out of order, events will be pulled in the order they were recieved) but depending on the length of the execution they could complete out of order. (i.e. the second task could finish before the first)"

Hence -> No ordered execution of events if they depend on the result of the others, if your processing subscription algorithm isn't 100% parallelizable you are out of luck.

 

Well, actually it's why I've implemented the Mutex extension  

 

Best Regards

BABA-SHYAM
14-Alexandrite
(To:seanccc)

Hi,

 

Subscription work in async mode. That means if you are calling one service and 100 of calls has triggered the subscription than multiple threads will be created and the service will called by 3-4 threads within the process.

There can be changes where you want to create Things using subscription, then there are chances 3-4 threads start accessing same thing which might be in process of creation which will lead some more issue. Better if you want to create any entity use for loop.

 

Regards

Shyam

Top Tags