AnsweredAssumed Answered

Selecting subscribers to a signal is not working in Postgres

Question asked by jwestra on May 18, 2016
Latest reply on Jun 2, 2016 by jbarrez
Hi!

I have a process definition with a SignalStartEvent.  When I execute signal received on it using the "in-memory DB", an event subscriber is found and fired, starting the process. 

However, when I run the application under Postgres using the same process definition, the query returns zero rows for subscribers and no process instance is ever started.  To make matters worse, when I take the SQL in the logs, run it in DBVisualizer with parameters like eventName and tenantId populated, the SQL is correctly returning an event subscriber row!

So, it appears the binding of the "parameter.eventName" and the "parameter.tenantId" are not working in Postgres.


<select id="selectSignalEventSubscriptionsByEventName" resultMap="eventSubscriptionResultMap" parameterType="org.activiti.engine.impl.db.ListQueryParameterObject">
    select *
    from ${prefix}ACT_RU_EVENT_SUBSCR EVT
    left outer join ${prefix}ACT_RU_EXECUTION EXC on EVT.EXECUTION_ID_ = EXC.ID_
    where EVENT_TYPE_ = 'signal'
       and EVENT_NAME_ = #{parameter.eventName}
       and (
        (EVT.EXECUTION_ID_ is null)
        or
        (EVT.EXECUTION_ID_ is not null AND EXC.SUSPENSION_STATE_ = 1)
       )
    <if test="parameter.tenantId != null">
        and EVT.TENANT_ID_ = #{parameter.tenantId}
    </if> 
    <if test="parameter.tenantId == null">
        and (EVT.TENANT_ID_ = '' or EVT.TENANT_ID_ is null)
    </if>  
</select>



select * from ACT_RU_EVENT_SUBSCR EVT left outer join ACT_RU_EXECUTION EXC on EVT.EXECUTION_ID_ = EXC.ID_ where EVENT_TYPE_ = 'signal' and EVENT_NAME_ = ? and ( (EVT.EXECUTION_ID_ is null) or (EVT.EXECUTION_ID_ is not null AND EXC.SUSPENSION_STATE_ = 1) ) and EVT.TENANT_ID_ = ?



This query totally returns the proper event subscriber when run from DBVisualizer to Postgres!!  Weird?

select * from ACT_RU_EVENT_SUBSCR EVT
left outer join ACT_RU_EXECUTION EXC on EVT.EXECUTION_ID_ = EXC.ID_
where EVENT_TYPE_ = 'signal'
and EVENT_NAME_ = 'UserUpdated'
and ( (EVT.EXECUTION_ID_ is null) or (EVT.EXECUTION_ID_ is not null
AND EXC.SUSPENSION_STATE_ = 1) ) and EVT.TENANT_ID_ = 'tenant1'





Outcomes