How to update a plan definition from a event listener

plugin-development

#1

Hello,

I have this issue with Bamboo v6.6.3. I would like to disable a build trigger from a event listener.

I have tried the following ways:

  • extending my listener class from HibernateEventListener class
  • using the @HibernateEventListenerAspect annotation
  • using the SAL TransactionTemplate

I always get the same error :

2019-01-31 11:49:01,717 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-3] [AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch even
t [com.atlassian.bamboo.v2.build.events.BuildTriggeredEvent[source=com.atlassian.bamboo.build.DefaultBuildExecutionManager@4229fa33]] from the invoker [SingleParamet
erMethodListenerInvoker{method=public void eu.europa.ec.digit.citnet.bamboo.eventlisteners.CheckPollingFrequency.handleEvent(com.atlassian.bamboo.v2.build.events.Bui
ldTriggeredEvent), listener=eu.europa.ec.digit.citnet.bamboo.eventlisteners.CheckPollingFrequency@430d63a6}]
java.lang.RuntimeException: could not initialize proxy - no Session
        at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54)
        at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:46)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
        at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
        at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
        at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
        at java.lang.Thread.run(Thread.java:748)

Is it actually possible to do this?

Thanks for any help.

Regards