iot service bus - high availability with internet of things (iot)/ api rest/ message broker

Post on 13-Apr-2017

203 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Palestrante: Alexandre Brandão Lustosa

IoT Service Bus - High availability with Internet of Things (IoT)/ API

Rest/ Message Broker

http://www.compsulmt.com.br/

IoT Service Bus - High availability with Internet of Things (IoT)/ API

Rest/ Message Broker

abrandao@stone.com.br

"A única maneira de fazer um excelente trabalho é amar o que você faz." (Steve Jobs)

Bacana!! :)

Clientes MundiPagg - 40% MarketShare

LOJAS DEPARTAMENTO MODA ENTRETENIMENTO ALIMENTOS

Temos mais de 1500 lojas em nosso portfólio, algumas delas são as maiores marcas brasileiras e internacionais.

ÓLEO TV

Vamos dominar o mundo!!

Quer jogar?

Relaxa!! D boa, você vai achar a solução!

{ Seja criativo!! :) =)

Quer um café?

C# .Net

jQuery

PHP

Magento

Angular.js

Node.js

Gulp

Java

Ruby

SQL Server

MongoDB

Kibana

Log StashRedis

RabbitMQCassandra

Scala Akka.Net

Python

TFS

Git

ApacheJira

SentryMonitis

Python

New RelicAzure

Nosso Stack

MVC

REST

Web APIGo

Vamos dominar o mundo!!!!

Faça parte do nosso time!

querotrabalhar@stone.com.br

abrandao@stone.com.br

"A única maneira de fazer um excelente trabalho é amar o que você faz." (Steve Jobs)

Faça parte do nosso time!

abrandao@mundipagg.com

{ TEMOS VAGAS }

"A única maneira de fazer um excelente trabalho é amar o que você faz." (Steve Jobs)

Alexandre Brandão

{ Microsoft C# .Net Solution Developer, C++ Linux Developer, C/C++ Embedded Programmer }

<contatos> <twitter>

@abrandaolustosa </twitter> <skype>

abrandao@stone.com.br </skype></contatos>

Gerente de TIArquiteto de Sistemas

Analista Desenvolvedor Sênior

curl -data “experiencia=16_anos&motivacao=inovacao%20e%20pesquisa” http://www.stone.com.br

Internet Of Things{ IoT }

“Definição” : “É uma revolução tecnológica a fim de conectar dispositivos eletrônicos utilizados no dia-a-dia (como aparelhos eletrodomésticos, eletroportáteis, máquinas industriais, meios de transporte, etc) à Internet, cujo desenvolvimento depende da inovação técnica dinâmica em campos tão importantes como os sensores wireless, a inteligência artificial e a nanotecnologia.”

{

}

https://www.youtube.com/watch?v=Q3ur8wzzhBU

Intel IoTWhat Does The Internet of Things Mean?

IoT

MedicinaMilitar

At HomeProdução

FabrilDesenvolvimento

Transporte

MobilidadePesquisa

Educação

AcessibilidadeAgro

IoT

Share Data Integration Systems

Cloud ServiceReal Time

FabrilBI

Artificial Intelligence

Dataware HousePesquisa

Media Big Data

Sensores• Temperatura• Luminosidade• Humidade• Reconhecimento de voz• Sensor de proximidade• Radar• Ultrasom• Infrared• Relay

Sensores Industriais

{ Microsoft Kinect }

{

Microsoft Kinect

}

Microsoft IoT RoadShow

Redmond – Washington/USA - Out/2016

Microsoft IoT RoadShow

Redmond – Washington/USA - Out/2016

Microsoft IoT RoadShow

Redmond – Washington/USA - Out/2016

Microsoft IoT RoadShow

Redmond – Washington/USA - Out/2016

Microsoft IoT RoadShow

Redmond – Washington/USA - Out/2016

Intel Edison – Arduino Platform

• 1 GB DDR3 RAM, 4 GB eMMC flash• 40 multiplexed GPIO interfaces• Bluetooth* 4.0, Wi-Fi*• Yocto Project*, Brillo*• Arduino* compatible• Open-source software development

environment• C/C++, Python*, Node.js*, HTML5, JavaScript*

Intel Edison – Arduino Platform

Intel Edison – Arduino Platform

Intel Edison Groove Kit

Raspberry Pi 3

Beaglebone

Beaglebone

Arduino Kit - Ebay

Fonte: ebay.com – 16/nov/2016

Arduino Kit - Ebay

Fonte: ebay.com – 16/nov/2016

Arduino Kit - Ebay

Fonte: ebay.com – 16/nov/2016

Intel XDK IDE

https://software.intel.com/pt-br/intel-xdk

Microchip PIC18 / PIC24 / PIC32 / DsPIC

Node.js is a JavaScript Runtime Built...

IoT - High Availability

IoT API RestService Bus

Message Broker

PersistenceLayer Databases

Devices

Devices

Devices

Devices

Devices

Sensors

Sensors

Sensors

Sensors

Sensors

Cloud Service / On Premise Cluster Service

IoT with Slack API

IoT with Slack API

https://github.com/alexandrebl

Método principal

//Main functionfunction main(){

//Setup configurations config();

//Set loop process each 4 seconds setInterval(function () {

//Set led process indicator on

ledProcessOn(); //Read Sensor var data = readTempSensor();//Post data on Slack postOnSlack(data); //Set led process indicator on

ledProcessOff();

}, 4000);}

Define o pino como saída para o LED

//Setup configurationfunction config(){

//Set pin direction

ledProcess.dir(mraa.DIR_OUT);}

//Set led process indicator onfunction ledProcessOn(){

//Write signal to up ledProcess.write(1);}

//Set led process indicator offfunction ledProcessOff(){

//Write signal to down ledProcess.write(0);

}

Envia o sinal altoAcende o LED

Envia o sinal baixoApaga o LED

function postOnSlack(data){ //Set options and message var options = {

//Webhook uri, replace by your uri Slack web hook integration

uri: https://hooks.slack.com/services/T0FES4821jluMzasy',

method: 'POST', //Request type json: data //Data

}; //Do post request request(options, function (error, response, body) {

//Verify response if (!error && response.statusCode == 200)

console.log("Success"); }else

console.log(error); }

});}

Exemplo de integração com API Rest

Repositório de códigos

https://github.com/alexandrebl

Message Broker

“Definição” : “An enterprise service bus (ESB) is a software architecture model used for designing and implementing communication between mutually interacting software applications in a service-oriented architecture (SOA)”

{

}

Integraçãode

Sistemas

Recursos

<wrong>Não utilize workflows centralizados e dependentes do banco de dados</wrong>

“Repense sua arquitetura”

Pipeline – Service Bus

{ Soluções – Service Bus }

- RabbitMQ- CloudAMQP (RabbitMQ)- Azure ServiceBus- IBM MQ Series- Amazon SQS- SQL Server Service Broker- Microsoft Message Queue- OpenShift- Kafka

https://www.rabbitmq.com/

• Robust messaging for applications• Easy to use• Runs on all major operating systems• Supports a huge number of developer

platforms• Open source and commercially supported• Multiplatform for Windows, Linux and Mac OS• Erlang

RabbitMQ - SDKs

C# .Net PHP

JavaRuby

ErlangPerl

Javascript

GoPython

Scala

Haskell

The Advanced Message Queuing Protocol (AMQP) is an open standard application layer protocol for message-oriented middleware. The defining features of AMQP are message orientation, queuing, routing (including point-to-point and publish-and-subscribe), reliability and security.

AMQP

To become the standard protocol for interoperability between all messaging

middleware

AMQP

PluginsManagement

• Gerenciamento• Configuração• Monitoramento

STOMP/ MQTT• Integrações utilizando outros protocolos de comunicação

Federation / Shovel• Configuração de cluster em redes não confiáveis

Características do RabbitMQ• Queue• Consumer

• Public/Subscriber• Exchange• Channel• Persitent

• Durável / Transiente• Atomicidade• Round-Robin• Acknolodge

• Ack/Nack• TTL (Time to Live)

Tipos de fila do RabbitMQ

• Basic• Work• Topic• Route• Fanout• RPC

Basic - RabbitMQ

P – ProducerC – ConsumerQueue in Red

The simplest thing that does something

Work - RabbitMQ

Distributing tasks among workers

Automatic - Round-Robin

Publish/Subscribe (FanOut)- RabbitMQ

Sending messages to many consumers at once

Exchange Types: direct, topic, headers and fanoutchannel.exchange_declare(exchange='direct_logs', type=‘fanout')

Routing - RabbitMQ

Receiving messages selectivelychannel.exchange_declare(exchange='direct_logs', type='direct')channel.basic_publish(exchange='direct_logs', routing_key=severity, body=message)

Topics - RabbitMQ

Receiving messages based on a patternchannel.exchange_declare(exchange='direct_logs',

type=‘topic')

RPC Async WorkFlow - RabbitMQ

Remote procedure call implementationDefine properties: CorrelationId and ReplyTo (QueueName to reply

message)

Install Client - RabbitMQ{ "require": { "php-amqplib/php-amqplib": "2.5.*" }}

$composer install or update

Tutorial: https://www.rabbitmq.com/tutorials/

API de Autorização { Stack }

Repositório de código: • https://github.com/alexandrebl• https://

github.com/alexandrebl/IMastersPHPExp2016

• NoSQL• Cache de dados• Dicionário (Chave/Valor)• Dados em memória• Persistência como opção• Stand Alone• Cluster• Replicação• Redis-cli• Redis Manager

• NoSQL• Json Format Data• Dados em disco• Stand Alone• Shard• Replica• Mongo Shell• RoboMongo• MongoChef

• PHP Framework• MVC• Open-source• REST API• Event/handle• Console• Composer

Fluxo da API de Autorização

Sending message with PHP

require_once __DIR__ . '/vendor/autoload.php';use PhpAmqpLib\Connection\AMQPStreamConnection;use PhpAmqpLib\Message\AMQPMessage;

$connection = new AMQPStreamConnection('localhost', 5672, 'guest',

'guest');$channel = $connection->channel();

Sending message with PHP

$channel->queue_declare('hello', false, false, false, false);

$msg = new AMQPMessage('Hello World!');$channel->basic_publish($msg, '', 'hello');

$channel->close();$connection->close();

Receiving message with PHP$callback = function($msg) { echo " [x] Received ", $msg->body, "\n"; };

$channel->basic_consume('hello', '', false, true, false, false, $callback);

while(count($channel->callbacks)) { $channel->wait();}

Sending message with C# .Netusing RabbitMQ.Client;

var factory = new ConnectionFactory() { HostName = "localhost"

};

using(var connection = factory.CreateConnection())using(var channel = connection.CreateModel()){ }

Sending message with C# .Netchannel.QueueDeclare(

queue: "hello", durable: false, exclusive: false, autoDelete: false, arguments: null);

Sending message with C# .Netvar body = Encoding.UTF8.GetBytes(message);

channel.BasicPublish(exchange: "", routingKey: "hello", basicProperties: null, body: body);

RabbitMQ - Tutoriaishttps://www.rabbitmq.com/getstarted.html

RabbitMQ – Curso on-linehttps://www.pluralsight.com/courses/rabbitmq-dotnet-developers

RabbitMQ Manager• Free• Gestão de objetos

• Queue• Exchange• Channels• Routing

• Taxa de tranferência• Simulação• Recursos de hardware

Cloud AMPQ based on RabbitMQ

https://www.cloudamqp.com/

Instalação do RabbitMQ Manager

rabbitmq-plugins enable rabbitmq_management

http://server-name:15672/

Azure Service Bus

Azure Service Bus Documentation

Azure Service Bus

•Queue•Notification Services

•Service Bus Pipeline

• IoT Hub Messaging•Dashboard Admin

Microsoft Azure Service Bus Manager

{Seja hoje uma pessoa

melhor do que você foi ontem

}

Pesquise...

Pesquise...Estude...

Pesquise...Estude...

Domine...

Pesquise...Estude...

Influencie...

Domine...

Alexandre Brandão

Twitter: @abrandaolustosaE-mail: abrandao@stone.com.brTel: +55 (21) 97367-6161

https://br.linkedin.com/in/abrandaolObrigado :)

Linkedin: abrandaol

https://github.com/alexandrebl

Alexandre Brandão

Twitter: @abrandaolustosaE-mail: abrandao@stone.com.brTel: +55 (21) 97367-6161

https://github.com/alexandrebl

Perguntas?

Linkedin: abrandaol

https://br.linkedin.com/in/abrandaol

top related