Skip to content

Instantly share code, notes, and snippets.

@hodrigohamalho
Last active July 15, 2020 22:04
Show Gist options
  • Save hodrigohamalho/a52dfb24383c89b4c6b1022123e195f2 to your computer and use it in GitHub Desktop.
Save hodrigohamalho/a52dfb24383c89b4c6b1022123e195f2 to your computer and use it in GitHub Desktop.
Integreatly Demo

Integration Demos

Integrating message-oriented middleware with a RESTful API using AMQ Online

This is available as a walkthrough. On Integreatly environment.

1) Create a queue

work-queue-requests

2) Show the applications working

http://crud-admin-tutorial-f6e1.apps.latam-e5e5.open.redhat.com/
http://frontend-admin-tutorial-f6e1.apps.latam-e5e5.open.redhat.com/

2) Open API Specification

http://crud-admin-tutorial-f6e1.apps.latam-e5e5.open.redhat.com/v2/api-docs

3) Setup Broker AMQP

url: amqp://messaging-0zrr7bobed.enmasse.svc:5672?amqp.saslMechanisms=PLAIN
user: admin
passwd: admin

4) Integration

work-queue-requests
{
	"$schema": "http://json-schema.org/draft-04/schema#",
	"type": "object",
	"properties": {
		"type": {
			"type": "string"
		}
	}
}

6) Design to API Management

Prepare the environment in Openshift

oc new-project fuse-demo
oc new-app --template=postgresql-persistent --param=POSTGRESQL_PASSWORD=redhat --param=POSTGRESQL_USER=redhat --param=POSTGRESQL_DATABASE=sampledb

Create and populate database

psql -U redhat -d sampledb
CREATE TABLE users(
 id serial PRIMARY KEY,
 name VARCHAR (50),
 phone VARCHAR (50),
 age integer
);
INSERT INTO users(name, phone, age) VALUES  ('Rodrigo Ramalho', '(11) 95474-8099', 30);
INSERT INTO users(name, phone, age) VALUES  ('Rafael Ramalho', '(61) 99988-8029', 32);
INSERT INTO users(name, phone, age) VALUES  ('Thiago Araki', '(11) 9999-9999', 33);
INSERT INTO users(name, phone, age) VALUES  ('Gustavo Luszynsk', '(11) 9999-9999', 33);
INSERT INTO users(name, phone, age) VALUES  ('Rafael Tuelho', '(11) 9999-9999', 33);

Configure a database connector in Fuse Online

url: jdbc:postgresql://postgresql.fuse-demo:5432/sampledb
user: redhat
password: redhat

Schema to use in API definition

{
    "id": 0,
    "name": "Rodrigo Ramalho",
    "phone": "11 95474-8099",
    "age": 30
}

Queries

select * from users;
INSERT INTO USERS(NAME,PHONE,AGE) VALUES(:#NAME,:#PHONE,:#AGE);

STAGING:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment