[Apiman-user] APIMan - questions / use-case

Eric Wittmann eric.wittmann at redhat.com
Mon Jan 19 08:46:50 EST 2015


Hi Anton - thanks for the note. :)

I checked the mailing list subscriber list and you are there, so perhaps 
it worked.  I'm CC'ing the mailing list on this reply.

As a matter of fact, custom policies is a very important feature of 
apiman.  That said, version 1.0.1.Final (the current latest) does not 
support an *easy* way to create a custom policy.  It is possible to do 
it, but you need to add your custom classes to the classpath of the API 
Gateway.

The good news is that the next major version of apiman (1.1.0.Final) 
will include a plugin feature that will allow you to easily contribute 
plugins (which contain custom policies).

I don't have a release date yet for when we will move from 1.0.x to 
1.1.x.   However, because you have shown interest in the feature, what I 
can do is move the feature from 1.1.x to 1.0.x.  So it will be released 
in the next minor release of apiman (1.0.2.x).

Sorry if that was confusing.

The bottom line is that I will backport the plugin feature from 1.1 to 
1.0 so that it will be available in the next release (1.0.2.Final).  I 
will also make sure to thoroughly document it in the Developer Guide 
before doing the release.

Until all of that happens, you can have a look at *how* to create an 
apiman plugin by going here:

https://github.com/apiman/apiman-plugins/tree/master/test-policy

An apiman plugin is a WAR with a little bit of extra sauce. 
Specifically it needs a file here:

META-INF/apiman/plugin.json

Example: 
https://github.com/apiman/apiman-plugins/blob/master/test-policy/src/main/apiman/plugin.json

Additionally in order for your custom policy (or policies) to be 
discovered you need one or more file in:

META-INF/apiman/policyDefs/

Example: 
https://github.com/apiman/apiman-plugins/blob/master/test-policy/src/main/apiman/policyDefs/test-policyDef.json

-Eric


On 1/19/2015 3:04 AM, Anton Hughes wrote:
> Hi Eric
>
> Firstly, thank you for your excellent work on APIMan, and Overlord. Two
> really exciting projects. Its really great to see how these have developed.
>
> Secondly - I tried to subscribe to the mailing list, but I never
> received a confirmation, so excusing me for writing to you directly.
>
> And thirdly - a question!
>
> *Custom Policy Types*
> Is it possible to create a custom policy type?
>
> Our use case is, the more our business partner calls a method, the more
> of a discount they get.  To elaborate, when they call the
> 'buySubscription()' method from
>
>   * 1 - 20x they get 0% discount
>   * 21 - 40x they get 3% discount
>   * 41 - 60x they get a 6% discount etc
>
>
> (note to self - could be good to use Drools decision tables for this).
>
> Then, when they call 'cancelSubscription()' we need to reduce the count
> and re-calculate.
> *Do you have documentation - or can you point us in the right direction
> to learn about developing a custom policy type?*
> *
> *
> Thanks Eric!
> *
> *
> *
> *
>
>
>
>
>
>
> --
> *
>
> **
>
> *
> *
>
> Anton Hughes
>
> Co-founder
>
> ah at magick.nu <mailto:ah at magick.nu>
>
> www.magick.nu <http://www.magick.nu>
>
> 	
>
> 	
>
> *
>
>
> *
>
> **
>
> *


More information about the Apiman-user mailing list