Post

Trident Sign: Listener Adapters

This post is about listener adapters implementation.

It is a really interesting question why Gendarme think Listener.HandleMessage is a large function. But now I have the answer and today I finally refactored on this function, and designed a few new classes.

Listener Adapters

For an SNMP v1 manager, actually only TRAP v1 message is useful. So why it needs to be bothered by other versions of messages? Now you can use a simple listener adapter for v1 manager and hook it to the Listener object.

Yes, it sounds like filters for incoming messages. That’s it.

I have also created a default adapter for backward compatibility, too. You can check how to use it in the samples.

Breaking Change Notice

Now all events for Listener component are obsolete except that one for exceptions. So you must follow the samples to update your code as so to adapt the changes.

Stay tuned.

© Lex Li. All rights reserved. The code included is licensed under CC BY 4.0 unless otherwise noted.
Advertisement

© - Lex Li. All rights reserved.

Using the Chirpy theme for Jekyll.

Last updated on November 06, 2024