3 r&d references, Interface categories, Interfaces for accessing resources – HP Intelligent Management Center Licenses User Manual

Page 27: Real-time event registration and receipt, Event registration

Advertising
background image

3 R&D References

This section provides information about the following topics:

Interface categories

Real-time event registration and receipt

Conventions and constraints

Error codes

Frequently-asked questions (FAQ)

Interface Categories

The interfaces of the iMC-RS framework can be classified into two categories, one for accessing
iMC resources, and the other for registering and receiving real-time events.

Interfaces for accessing resources

This category of interface works in the synchronous request/response mode to response the request
from the client for accessing resources. The access requests include operations such as read,
update, insert, and delete.

Unless otherwise specified, all iMC-RS APIs are of this category.

You can select a proper class library to access iMC-RS. For information on how to use this category
of interface, see

Client Access

.

Interfaces for registering and receiving real-time events

This category of interface processes registration of particular types of event from the client, and
informs the client of the latest events in real time with asynchronous notification. The interface
implements HTTP server push to register events such as real-time alarms and real-time device status
changes, and informs the client of the event immediately after it occurs.

For more information about this category of interface, see “

Real-Time Event Registration and

Receipt

.

Real-Time Event Registration and Receipt

The iMC-RS framework can receive and accept the registration requests of real-time events. After
receiving an event registration request from the client, the server checks the validity of the request,
and if the request is valid, returns the 202 (Accepted) status code to the client and maintains the
HTTP connection (which is a long connection) to the client. When the client registration event occurs,
the server pushes the event to the client. In addition, the server sends periodic heartbeat events to
the client every minute to verify network connections.

This section describes real-time event registration and receipt by using the java.net.URL access
method.

Event registration

iMC-RS receives an event registration request in GET method.

URL url = new URL("http://imc_host:8080/imcrs/events?type=type_code");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("accept", "application/xml");
if (conn.getResponseCode() == 202) {
// Registration succeeds. Start to receive the event notification.
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
......
}

Interface Categories

27

Advertising