Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 7 Next »

Overview

UHIMS Events refers to messages that UHIMS publishes to the UH Message Broker. It is a convenient way of receiving identity, affiliation, and contact information about the students, faculty and staff that your application serves. The data comes from several official sources, including Banner, PeopleSoft, RCUH, SECE and WPMS. UHIMS digests the information from these various systems and makes it available in one place.

Message Specs

(warning) Note that <messageRoutingKey> in the above specs is not an actual XML tag. It represents the message routing key for the message being described.

Connection Settings

Setting

Value

Comments

Host

esb.hawaii.edu

 

Port

5671

SSL

Vhost

uhims

 

Exchange

uhims-exchange

 

User, Password

(app-specific)

This will be provided when you request your UH Message Broker account

Queue and Bindings

(app-specific)

This will be provided when you request your UH Message Broker account

Requesting Access

  1. Review UHIMS Events - Message Specs and determine which messages you are interested in.
  2. Contact its-iam-help@lists.hawaii.edu to request access:
    • Provide a desired username for the UH Message Broker. This should be something related to your application, not your personal username, e.g.
      • student_housing
    • Provide a desired queue name. It will always be preceded by the above username, e.g.
      • student_housing.prod
      • (warning) You must register your queues with us. We will declare the queue and its bindings for you. This is to ensure the queues exist and have the correct settings for persistence, high-availability, etc.
    • Provide the message routing key pattern for the messages you want to be routed to your queue. It is OK to provide multiple patterns. Here are some examples:
      • # (you are interested in all messages)
      • username.# (you only want username messages)
      • affiliation...uhm.hris (you only want affiliation changes for UH Manoa coming from PeopleSoft)

Reading UHIMS Events - Java Example

  1. Download the RabbitMQ Java client from http://www.rabbitmq.com/download.html (there should be libraries and examples for other languages there)
  2. Here is a SampleUhimsConsumer.java you can try.
    • Replace the following with your own values:
      • yourRabbitMqUsernameHere
      • yourRabbitMqPasswordHere
      • yourQueueNameHere
      • esb-test.its.hawaii.edu with esb.hawaii.edu when your code is ready to use the production RabbitMQ service.
        import java.io.*;
        import java.security.*;
        import com.rabbitmq.client.*;
        
        public class SampleUhimsConsumer {
        
            private final static  String queueName    = "yourRabbitMqUsernameHere.yourQueueNameHere";
            private final static  String exchangeName = "uhims-exchange";
            private final static boolean durable       = true;
            private final static boolean exclusive     = true;
            private final static boolean autoDelete    = false;
            private final static boolean autoAck       = true;
        
            public static void main(String[] argv) throws Exception {
        
            ConnectionFactory factory = new ConnectionFactory();
        
            factory.setHost("esb-test.its.hawaii.edu");
            factory.setPort(5671);
            factory.setVirtualHost("uhims");
            factory.setUsername("yourRabbitMqUsernameHere");
            factory.setPassword("yourRabbitMqPasswordHere");
        
            factory.useSslProtocol(); // Tells the library to setup the default Key and Trust managers for you
                                      // which do not do any form of remote server trust verification
        
            Connection conn       = factory.newConnection();
            Channel    channel    = conn.createChannel();
            System.out.println(" [*] Waiting for messages. To exit press CTRL+C");
            QueueingConsumer consumer = new QueueingConsumer(channel);
            channel.basicConsume(queueName, autoAck, consumer);
        
            while (true) {
              QueueingConsumer.Delivery delivery = consumer.nextDelivery();
              String message = new String(delivery.getBody());
        
              // Your code processes the message here
              System.out.println(" [x] Received '" + message + "'");
        
              // If your code fails to acknowledge the message,
              // it will be redelivered.  This is a safety feature.
              // Refer to Message Acknowledgement section in
              // http://www.rabbitmq.com/tutorials/tutorial-two-java.html
        
              channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false);
            }
        
          }
        }
        
  3. To quickly compile and run the above, you could save the above code as SampleUhimsConsumer.java in the same directory where you downloaded the above Java client (we tried it with rabbitmq-java-client-bin-2.7.1):
    • javac -cp rabbitmq-client.jar SampleUhimsConsumer.java
    • java -cp .:commons-io-1.2.jar:commons-cli-1.1.jar:rabbitmq-client.jar SampleUhimsConsumer
  4. That's it!
  • No labels