Forum Discussion
Lalit_Kumar_533
Nimbostratus
Jul 22, 2005Event Notification Samples in Java
I want to create a listener in Java which should listen to node enable/disable events in F5.
I looked at the article http://devcentral.f5.com/Default.aspx?tabid=29&newsType=ArticleView&articleId=15
which seems to be relevant , but I could not find any sample java code implementation for the above event model.
Can anybody provide me the sample code which implements the Management.EventNotification and Management.EventSubscription to create listener/subscriptions for the node events in Java.
Thanks.
18 Replies
- This is great! I personally wrote the EventSubscription and EventNotification interfaces and underlying infrastructure and am excited to see someone use them. Currently we don't have any java samples for the subscription or notification interfaces. I do have a .NET subscription client and webservice to receive the notifications. I've also implemented Perl samples as well.
The notification interface is very minimal, so implementation of one should be not that difficult. I haven't included samples in the SDK for java just because there are so many deployment options out there for building webservices in java that I didn't want to miss one.
Building the client, if you are using Axis, is a piece of cake. Just run the WSDL through WSDL2Java and you'll have a set of working client stubs.
When you are building your notification endpoint, make sure to make use of the EventNotificationClient samples in either C or Perl that test the endpoint. This makes implementing and debugging the interface much easier.
Also, when you get a working endpoint, please let us know. If you submit it to CodeShare I can get it included in an upcoming SDK.
Feel free to post questions about the use of the interfaces anything comes up. I've got a pretty good handle on their ins and outs.
-Joe - Lalit_Kumar_533
Nimbostratus
Hey Joe,
I am totally new to f5 APIs.
Could you please tell me the names of interfaces and their methods I need to implement (specific to Java ) with their fully qualified name.
It would be useful if you could just write a few lines even in text form as to what is expected while overriding methods?
Also it would be useful if you could provide the .NET code ...just to get a feel ...what is expected out of it.
And one more basic question why do I need a client ...I thought there should be just a listener ..listening for events(node on/off) in my case and I should be able to handle it however i wish....
Thanks
Lalit - I'll answer your questions a bit out of order so that they all make sense.
There are 2 interfaces you need to make use ofManagement::EventSubscription
Management::EventNotification
The EventSubscription interface is used to create subscriptions to events. You will need to build a client application (or use the .NET sample included in the SDK) to be able to manage (create, check status, etc) subscriptions to your endpoint implementation. There is currently no GUI in the product to manage this at this time.
The EventNotification interface is the endpoint you must implement to allow the BIG-IP to send messages to. It needs to be a web service listening on HTTP or HTTPS with our without authentication. Again, a .NET asmx sample is included in the SDK. There is only one method in the EventNotification event that you must support:void Management::EventNotification::events_occurred ( Management::EventNotification::EventSource event_source, string subscription_id, Management::EventNotification::EventData[] event_data_list, Common::TimeStamp time_stamp );
Aside from the subscription client, in the SDK we've included a test client that you can use to test your EventNotification::events_occurred implementation directly. This makes it much easier than having to test it through the BIG-IP. Once the test client reports conformance, there should be no issue with plugging it into the BIG-IP to send events to.
Hopefully this got everything. For a reference look in the following directories in the 9.0 SDK:sdk_root/sdk/samples/soap/c/Microsoft/Management/EventManagement
sdk_root/sdk/samples/soap/c/Microsoft/Management/EventNotification
sdk_root/sdk/samples/soap/c/Microsoft/Management/EventNotificationClient
Hope this helps!
-Joe - Lalit_Kumar_533
Nimbostratus
Joe,
I guess these are the interfaces while coding in .NET
But i am programming in Java and I could not locate corresponding interfaces in Java , Could you please provide me the names/location of Java interfaces and the methods I need to implement.
And if you have some small working code , can you mail it to me ?
Thanks
Lalit - The interfaces are language independent. They are defined in the WSDL documents located in the sdkroot/sdk/wsdl directory and are documented in the api reference. I'll double check when I get back in the office whether or not there is an issue with the client bindings for the java stacks.
Which java toolkit are you using and which version of the iControl SDK do you have? There are some limits with Apache WS-SOAP in it's lack of support for 2 dimensional arrays. I believe development halted on WS-SOAP a few years back and all effort is put into Apache Axis right now (which fully supports 2-d arrays).
-Joe - Shawn_Higgin_84
Nimbostratus
Hi, I am trying to help Lalit and team out to get this working. However, they are getting an error when running the following:
( perl EventSubscription.pl hostname 443 "uName"
"Psswd" create)
- Error Message :- SOAP-ENV:Server User "xyz" is not
authorized to access
"urn:iControl:Management/EventSubscription::create".
When was the Event Notification implemented? We are running bigip software v9.1. Is this supported on v9.1?
Thanks,
Shawn Higgin - The EventNotification interface was introduced in BIG-IP v9.0 so you should be fine there. The error message states what the issue is. For methods that modify the configuration, the iControl user must be in the administrators group (or operator group for state changes - up and down of nodes, etc). Odds are your user "xyz" needs to have it's privileges bumped up.
Have you tried other method calls that actually modify the configuration with this user account?
-Joe - Shawn_Higgin_84
Nimbostratus
Hi Joe, thanks for the information. The user currently has "Operator" privileges. This user is able to disable and enable nodes, etc. Just not delete/add nodes to pools or create VIPs, etc. We do not want to allow the program that is used by our monitoring software to be able to have full access.
Does the Event Notification process need admin rights? If so, is there a way to restrict it so that this one user account is only able to run the event notification and not grant full admin rights?
Thanks - I guess I should make sure this is clear. Your error message states that you are using the EventSubscription interface to create the subscription. The EventNotification interface is an outbound call from BIG-IP to your webservice.
As for the user rights. Right now, users who create objects (including subscriptions) must be in the admin group. Unfortunately there is no way around that as the privileges are tied to groups not users.
-Joe - Shawn_Higgin_84
Nimbostratus
Thanks. Are there any plans to allow operstor level or some other level with more custom options towards setting permissions?
Is there another way that we can make this work without admin permissions?
We are trying to allow our monitoring software to receive the up/down status of the nodes realtime. I am thinking SNMP traps from tmm would be an equivilent method.
Any other suggestions would be greatly appreciated.
Thanks
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
