Registering Event Handlers when using db_app_configs

Imported Google Group message. Original thread at: Redirecting to Google Groups Import Date: 2016-01-19 21:06:32 +0000.
Sender:Khirod Kant Naik.
Date:Monday, 16 February 2015 05:43:11 UTC.

I’m trying to register a custom Event Handler when using API definitions from DB. I want to invoke the event handler when RateLimitExceeded Event occurs. I tried to modify the db API definition in collection tyk_apis in database tyk_analytics. However when I restart Tyk I can see that the event handler is not loaded since I can’t see the log message on loading of Handler.

The event_handler and API definition in MongoDB is attached.

Imported Google Group message.
Sender:Martin Buhr.
Date:Monday, 16 February 2015 06:27:41 UTC.

You might be missing the tykjs path in your Tyk.conf, it points to the Tyk JS framework classes that need to be loaded for the event handlers to work:

“tyk_js_path”: “/etc/tyk/js/tyk.js”,

Thanks,
Martin

On 16 Feb 2015, at 05:53, Khirod Kant Naik [email protected] wrote:

  • show quoted text -


You received this message because you are subscribed to the Google Groups “Tyk Community Support” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web, visit https://groups.google.com/d/msgid/tyk-community-support/22821847-3f4a-4dbb-8f14-5f481af29705%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Imported Google Group message.
Sender:Khirod Kant Naik.
Date:Monday, 16 February 2015 05:53:37 UTC.

Here is the log

INFO[0000] No configuration file defined, will try to use default (./tyk.conf)
INFO[0000] Setting up analytics DB connection
INFO[0000] Using MongoDB cache purge
INFO[0000] Connecting to redis on: localhost:6379
INFO[0000] Listening on port: 8080
INFO[0000] Listening on [::]:8080
INFO[0000] Using App Configuration from Mongo DB
INFO[0000] Loading JS File: /etc/tyk/event_handlers/sample/queueHandler.js
INFO[0000] Init Event Handler: RatelimitExceeded
INFO[0000] Checking for transform paths…
INFO[0000] Loading API configurations.
INFO[0000] Loading API Spec for: Interns API
INFO[0000] Connecting to redis on: localhost:6379
INFO[0000] Connecting to redis on: localhost:6379
INFO[0000] Health Checker initialised.
INFO[0000] Connecting to redis on: localhost:6379
INFO[0000] Connecting to redis on: localhost:6379
INFO[0000] Loading Middleware
INFO[0000] Connecting to redis on: localhost:6379
INFO[0000] Rate limits available at: /tyk/rate-limits/

Imported Google Group message.
Sender:Khirod Kant Naik.
Date:Monday, 16 February 2015 06:20:22 UTC.

Hi,

Can you send through your Tyk.conf file?

Thanks,
Martin

  • show quoted text -

  • show quoted text -


You received this message because you are subscribed to the Google Groups “Tyk Community Support” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web, visit https://groups.google.com/d/msgid/tyk-community-support/22821847-3f4a-4dbb-8f14-5f481af29705%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Imported Google Group message.
Sender:Martin Buhr.
Date:Monday, 16 February 2015 06:51:22 UTC.

Thanks Martin, The tyk.js file was missing. Infact the js folder was empty. This might have happend when I re-installed the tyk v1.5 from deb file.