Showing posts with label openshift. Show all posts
Showing posts with label openshift. Show all posts

Wednesday, October 21, 2015

Using the Unified Push Server with BPMS

During this past Red Hat Summit I worked on a session with Mobile, Fuse and BPMS.  It was a great pleasure working with Phil SimpsonJavier Perez and  Maggie Hu to build and present the demo.  Below I walk through setting up and using the Push Notification Server.  For information on submitting claims through the mobile application and the adjudicator review you can review Maggie's Blog on Red Hat Mobile Application Platform - Connecting to JBoss BPMSuite REST.

Red Hat Summit 2015 - 
Photo Taken by Wanja Pernath

This article is part of a series we're putting together for the Build an Enterprise Application in 60 Minutes with JBoss Middleware session at the Summit. The original slide decks can be found below from Maggie on Slideshare. Please take a look at the slide decks to get a better idea on the use case we're working with.

Basically, we're allowing people to submit claims quickly from their mobile devices with some basic information when an auto accident happens. The claim will get submitted to the insurance company, an adjudicator will review the claim, set the settlement amount, and complete the claim. Then the policy holder will receive a push notification on their mobile device on the settlement amount.




What is Push Notification and its benefits?

A push notification is a message or alert delivered by a centralized server (on premise or cloud) to a device.   Unlike pull notifications, in which the client must request information from a server, push notifications originate from a server. Typically, the end user must opt-in to receive alerts; opt-in usually takes place during the install process and end users are provided with a way to manage alerts if they change their minds later on.

An important advantage of push notifications in mobile computing is that the technology doesn't require specific applications on a mobile device to be open in order for a message to be received. This allows a smartphone to receive and display social media or text message alerts even when the device's screen is locked and the social media application that is pushing the notification is closed.

The Red Hat Mobile Unified Push Server (Aerogear) can be seen as a broker that distributes push messages to different 3rd party Push Networks. The graphic below gives a little overview:


  1. One PushApplication and at least one mobile platform variant must be created.
  2. The variant credentials that are generated and stored by the UnifiedPush Server must be added to the mobile application source, enabling the application to register with the UnifiedPush Server once it is installed on mobile devices.
  3. Sending a push message can happen in different ways: The AdminUI can be used to send a (test) message to registered devices. However, in a real-world scenario the Push Notification Message request is triggered from a backend application, which sends its requests using the Sender API. Different SDKs for different languages are supported.
  4. The push request is then translated into platform specific details for the required variant Push Network. The Dashboard of the AdminUI gives a status report if a message is sent to the Push Network.
  5. The UnifiedPush Server does not directly deliver the message to the mobile device. This is done by the appropriate variant Push Network. Note: There can be latency in the actual delivery. Most Push Networks, such as APNs or GCM, do not guarantee to deliver messages to mobile devices.
Setting Up the Unified Push Server on Openshift

The Unified Push Server allows developers to send native push messages to Apple’s Push Notification Service (APNS) and Google’s Cloud Messaging (GCM). It features a built-in administration console that makes it easy for developers to create and manage the push related aspects of their applications for any mobile development environment. Includes client SDKs (iOS, Android, & Cordova), and a REST based sender service with an available Java sender library.

In our example we setup the UPS on Openshift instead of on premise and we do this through the Openshift Application Manager.  First we need a Openshift account.  You can sign up for a free account for 3 small gears.


Next we will create an openshift application.


We will use the Unified Push Server 1.0 Cartridge which will also add MySQL to the Application.  We can take the defaults and click Create Application Button.  After creating the application a credentials screen is displayed with URLs and credentials.


Now we can sign onto the console to create applications, variants, etc and monitor messages.  Let's open the dashboard for the Push Server, ie https://jbossunifiedpushtest2-ossmentor.rhcloud.com/ag-push, and login with admin/admin which will bring up the dasboard main screen.


Now we want to add an application to receive the push notifications.  We click on applications and the create application button.  Once created we can look at the variants.  This shows the application ID and Master Secret for the application which we will use in our example.



At this point we can create variants for Android and iOS.   For this first example we will create an application but won't use variants and register devices.  We will just show the notification getting to the push notification server.  Now that the application is created let's do a quick test.

Test sending a message to the UPS

I used the Advanced REST Client in Chrome to test the message.  I setup the project with the URL, the Authorization and Content Type as shown below.  I put in some sample data for the notification.


After clicking on send I get a Job submitted response and can lookup the message in the dashboard.



Now let's move onto how we can make the call from BPMS.

Sending a notification message from BPMS to the UPS



First in our Business Process we add the message in a script task to the Response Body for the REST call.

kcontext.setVariable("requestBody","{\"ttl\":3600,\"message\":{\"alert\":\"Your Payment Amount is:"+kcontext.getVariable("paymentAmount")+"\",\"action-category\":\"some value\",    \"sound\":\"default\",\"badge\":2,\"content-available\":true},\"simple-push\":\"version=123\"}");

Next in our Business Process we added a REST Task to make the call to the UPS to send the claim award message.  A couple of items to note on the Task.  The first is the data assignments.  The username is the Application ID and the password is the Master Secret as seen in the screen shots below.  Also note the URL for the domain REST API for UPS in addition to the Basic Authorization.




Note the App settings in addition to the Android Variant settings for Google Cloud messaging.
Also in the REST Task we setup the Data Input and Output as indicated below.

One additional item that was required is the work definition as displayed below.

import org.drools.core.process.core.datatype.impl.type.StringDataType;
import org.drools.core.process.core.datatype.impl.type.ObjectDataType;
[
  [
    "name" : "Email",
    "parameters" : [
      "From" : new StringDataType(),
      "To" : new StringDataType(),
      "Subject" : new StringDataType(),
      "Body" : new StringDataType()
    ],
    "displayName" : "Email",
    "icon" : "defaultemailicon.gif"
  ],
  [
    "name" : "Log",
    "parameters" : [
      "Message" : new StringDataType()
    ],
    "displayName" : "Log",
    "icon" : "defaultlogicon.gif"
  ],
  [
    "name" : "WebService",
    "parameters" : [
        "Url" : new StringDataType(),
         "Namespace" : new StringDataType(),
         "Interface" : new StringDataType(),
         "Operation" : new StringDataType(),
         "Parameter" : new StringDataType(),
         "Endpoint" : new StringDataType(),
         "Mode" : new StringDataType()
    ],
    "results" : [
        "Result" : new ObjectDataType(),
    ],
    "displayName" : "WS",
    "icon" : "defaultservicenodeicon.png"
  ],
  [
    "name" : "Rest",
    "parameters" : [
        "Url" : new StringDataType(),
        "Method" : new StringDataType(),
        "ConnectTimeout" : new StringDataType(),
        "ReadTimeout" : new StringDataType(),
        "Username" : new StringDataType(),
        "Password" : new StringDataType()
    ],
    "results" : [
        "Result" : new ObjectDataType(),
    ],
    "displayName" : "REST",
    "icon" : "defaultservicenodeicon.png"
  ]
]
That was all that is required to send a push notification from BPMS to the Unified Push server.  You can see the messages in the UPS console.
All variants associated with the Application in UPS will receive the notification.  We will cover the Android application in a follow up article to register the device with Google Cloud Messaging (GCM) and receive the notification. 

References:
http://searchconsumerization.techtarget.com/definition/push-notification
https://aerogear.org/docs/unifiedpush/ups_userguide/index/
https://developers.openshift.com/en/xpaas-unified-push.html

Thursday, June 18, 2015

Win Prizes at DevNation Code Challenge!


Join us Monday, June 22, 6:00pm-11:00pm in Room 200 at DevNation in Boston!  Show off your coding skills and win prizes at the DevNation Code Challenge! Using showcased technologies from cloud, mobile, and data services--plus your creativity--you’ll build an extraordinary project with friends (or on your own). Judges will choose winners from the projects built and presented during the session. The winners will walk away with awesome prizes and bragging rights (until next year). 

Don’t worry about dinner and drinks--that’s on us. Just bring your laptop and be ready to dive in.

Pre-register for this event via EventBrite at http://tinyurl.com/DevnationCodeChallenge; seating will be limited. *You must be registered for DevNation in order to attend this event.

Tentative Prizes (for max team of 8):
First Prize - Drone with Camera
Second Prize - Banana Pi
Third Prize - Wrist Activity Tracker

Judges:
Mark Little, VP, Red Hat
Andrew Rubinger, Developer Advocate and Program Manager, Red Hat
Tony Stafford, VP Technical Solutions, Shadow-Soft
Diogenes Rettori, xPaaS Product Manager, Red Hat
Conor O'Neill, Mobile Product Manager, Red Hat

Featured Technology Speakers:
Mobile - Javier Perez, Director of Product Management and Global Consulting, Red Hat
Cloud - Diogenes Rettori, xPaaS Product Manager, Red Hat
Data Services - Mark Drilling, Principal Software Engineer, Red Hat, and Cojan Ballegooijen, Senior Solution Architect, Red Hat
Frontend - Joshua Wilson, Senior Software Engineer, Red Hat
Integration/Camel - Kenny Peeples, JBoss Technology Evangelist, Red Hat

MCs:
Arun Gupta
Director, Developer Advocacy and Technical Marketing, Red Hat

Arun Gupta is director of developer advocacy at Red Hat and focuses on Red Hat JBoss Middleware. As a founding member of the Java EE team at Sun Microsystems, he spread the love for technology all around the world. At Oracle, he led a cross-functional team to drive the global launch of the Java EE 7 platform through strategy, planning, and execution of content, marketing campaigns, and program. He is a prolific blogger since 2005 and have authored 1500+ blogs on technology. Arun has extensive speaking experience in ~40 countries on myriad topics and is a JavaOne Rockstar. He also founded the Devoxx4Kids chapter in the USA and continues to promoting technology education amongst kids. An author of a best-selling book, an avid runner, a globe trotter, a Java Champion, JUG leader, he is easily accessible at @arungupta.

Kenny Peeples
Jboss Technology Evangelist, Red Hat

Enjoys finding innovative ways to integrate and use Open Source Software. View his blog at ossmentor.com and follow him on twitter @ossmentor.

Sunday, June 14, 2015

Summit by day, party by night

Visit the Red Hat booth in Hall D at Red Hat Summit where you can see our awesome line up of demos and pick up a card with the party details which is being brought to you by the Application Platforms Business Group.  We look forward to seeing you there!


Monday, May 18, 2015

Data Virtualization Primer - Introduction

This week we are starting the Data Virtualization Primer which I am splitting into 3 series - The Basics, The Connectors and the Solutions.  My goal is to publish one or two articles a week, each one covering a topic that can be reviewed in a short amount of time.  Demos and examples will be included and some of the topics will be broken into multiple parts to help easily digest them.  The planned outline is below as well as our first topic which is Data Virtualization Introduction.

Series 1 - The Basics
  1. Introduction
  2. The Concepts (SOAs, Data Services, Connectors, Models, VDBs)
  3. Architecture
  4. On Premise Server Installation
  5. JBDS and Integration Stack Installation
  6. WebUI Installation
  7. Teiid Designer - Using simple CSV/XML Datasources (Teiid Project, Perspective, Federation, VDB)
  8. JBoss Management Console
  9. The WebUI
  10. The Dashboard Builder
  11. OData with VDB
  12. JDBC Client
  13. ODBC Client
  14. DV on Openshift
  15. DV on Containers (Docker)
Series 2 - The Connectors

This series will cover each connector including example demos of each.

Series 3 - The solutions
  1. Big Data Example
  2. IoT Example
  3. Cloud Example
  4. Mobile Example
  5. JBoss Multi-product examples (Fuse/BPMS/BRMS/Feedhenry/DG)

Monday, May 4, 2015

Create your Data Services easily


We will be bringing you more Data Virtualization Demos, Videos and Workshops.  I wanted to start out this week  giving you some resources to easily spin up Data Virtualization on Openshift, Start a database and expose a OData REST API for the VIrtual Database.

Make sure to create your free OpenShift user account first by following the instructions here.

Next either deploy the cartridge via the OpenShift Web Console or the OpenShift command line tools.
  • Deploy the cartridge via the OpenShift Web Console . On the Applications tab, choose 'Add Application...' - then select the 'JBoss Data Virtualization 6' cartridge under the xPaaS section. Full installation instructions are provided.
  • Alternately, if you have the OpenShift command line tools installed, you can deploy the DataVirtualization cartridge via command line:
rhc app-create <myApp> jboss-dv-6.0.0
Regardless of the install method when the installation completes, you will be presented with a list of generated users and passwords similar to the screencap below. Make sure you save them!
Now that you have a Data Virtualization OpenShift Application let's setup a MySQL database.  You can follow these instructions to:

  1. Add MySQL database to your OpenShift Data Virtualization instance.
  2. Add phpMyAdmin which is the web interface for easy management of your MySQL database. 
  3. Add data to the database for testing.
Next we want to test out the WebUI to build a Virtual Database.  You can follow these instructions to create the Virtual Database.  You will then be able to access your data through REST, OData and JDBC from the URLs provided.  Below shows example endpoints.


If you want to try the latest release of Data Virtualization and the WebUI on premise the download the product and webui from jboss.org.   Then follow the instructions below to deploy and start the WebUI.

To install the WebUI :

1) Install DV61

2) After installing DV61, give the teiidUser the odata and rest roles. The user must have these roles to access the rest and odata endpoints. The roles file is 

<SERVER_DIR>/standalone/configuration/application-roles.properties the teiid user will look like this: teiidUser=user,odata,rest 

3) download the war and copy it into

 <SERVER_DIR>/standalone/deployments 

4) access the app at localhost:8080/dv-ui login with admin/admin

Now you can start building Data Services easily!


Wednesday, April 1, 2015

Fuse Stickers across the Globe

We have new Fuse Stickers to share across the globe!   Keep watching for the stickers shown below which include JBoss Fuse and JBoss Fuse for xPaaS.   You can find them at conferences and local workshops through the JBoss Technology Evangelists, Product Managers and Product Marketing Managers.  Follow us through twitter as well as on JBoss Demo Central.


Christina Lin, JTE
Kenny Peeples, JTE
Eric Schabell, JTE
Thomas Qvarnström, JTE 
Sameer Parulkar, PMM



Tuesday, March 24, 2015

API management: Critical for success in the digital economy

Please join us for a API Management webinar Thursday, April 9, 2015 at 11:00 AM EST.  Syed Rasheed, Senior Product Marketing Manager at Red Hat, Mark Cheshire, COO at 3scale, Manfred Bortenschlager, API Market Development Director at 3scale and myself are the speakers for the webinar.

Just as every business has a website to share data or services for people, soon application programming interfaces (APIs) will be used to share such assets in a machine-processable way. Gartner predicts that by 2016, 75% of the Fortune 1000 will offer public web APIs and 50% of business to business collaboration will take place through web APIs.

API management provides organizations with full control and visibility of their APIs and helps to use the power of sharing organization's assets—data or services—via APIs, in a simple and quick way. During this session, we will introduce how you can use Red Hat® JBoss® Fuse, OpenShift by Red Hat, and 3scale to manage and control APIs. We will conclude with a practical demo.

Join this webinar to learn how to:

  • Build and deploy your APIs.
  • Secure your APIs via access control.
  • Control your APIs via usage policies.
  • Operate your APIs via monitoring, analytics, reporting and billing.
  • Engage with developers through developer portals and interactive API documentation.

Tuesday, February 10, 2015

API Management Part 1 with Fuse on Openshift and 3scale on Amazon Web Services


Introduction


A way organizations deal with the progression towards a more connected and API driven world, is by implementing a lightweight SOA/REST API architecture for application services to simplify the delivery of modern apps and services.

In the following blog series, we're going to show how solutions based on 3scale and Red Hat JBoss Fuse enable organizations to create right interfaces to their internal systems thus enabling them to thrive in the networked, integrated economy.

Among the API Management scenarios that can be addresses by 3cale and Red Hat with JBoss Fuse on OpenShift, we have selected to showcase the following:

• Scenario 1 – Fuse on Openshift with 3scale on Amazon Web Services (AWS)
/2015/02/apimanagement-fuse-3scale-scenario1.html
• Scenario 2 – Fuse on Openshift with APICast (3scale’s cloud hosted API gateway)
/2015/02/apimanagement-fuse-3scale-scenario2.html
• Scenario 3 – Fuse on Openshift and 3scale on Openshift
/2015/02/apimanagement-fuse-3scale-scenario3.html

The illustration below depicts an overview of the 3scale API Management solution integrated with JBoss.  Conceptually the API Management sits in between the API backend that provides the data, service or functionality and the API Consumers (developers) on the other side.  The 3scale API Management solution subsumes: specification of access control rules and usage policies (such as rate limits), API Analytics and reporting, documentation of the API on developer portals (including interactive documentation), and monetization including end-to-end billing.
This article covers scenario 1 which is 3scale on AWS and Fuse on Openshift. We split this article into four parts:
  • Part 1: Fuse on Openshift setup to design and implement the API
  • Part 2: 3scale setup for API Management using the nginx open-source API gateway
  • Part 3: AWS setup for API gateway hosting
  • Part 4: Testing the API and API Management 
The diagram below shows what role the various parts play in our configuration.

Part 1: Fuse on Openshift setup


We will create a Fuse Application that contains the API to be managed. We will use the REST Quickstart that is included with Fuse 6.1. This requires a Medium or Large gear to be used as using the small gear will result in out of memory errors and/or horrible performance.

Step 1: Sign onto your Openshift Online Account. You can sign up for a Openshift Online account if you don’t have one.
loginopenshift.png

Step 2: Click the Add Application button after singing on.


Step 3: Under xPaaS select the Fuse type for the application
fuseopenshift.png


Step 4: Now we will configure the application. Enter a Public URL, such as restapitest which gives the full url as appname-domain.rhcloud.com. As in the example below restapitest-ossmentor.rhcloud.com. Change the gear size to medium or large which is required for the Fuse cartridge. Now click on Create Application.


Step 5: Click Create Application

Step 6: Browse to the application hawtio console and sign on

Step 7: After signing on click on the Runtime tab and the container. We will add the REST API example.

Step 8: Click on Add a Profile button
Step 9: Scroll down to examples/quickstarts and click the rest checkbox then add. The REST profile should show on the container associated profile page.



Step 10:  Click on the Runtime/APIs tab to verify the REST API profile.

Step 11: Verify the REST API is working. Browse to customer 123 which will return the ID and name in XML format.

Part 2: 3scale setup



Once we have our API set up on Openshift we can start setting it up on 3scale to provide the management layer for access control and usage monitoring.

Step 1: Log in to your 3scale account. You can sign up for a 3scale account for free at www.3scale.net if you don’t already have one. When you log in to your account for the first time you will see a to-do list to guide you through setting up your API with 3scale.



Step 2: If you click on the first item in the list “Add your API endpoint and hit save & test” you’ll be taken directly to the 3scale Integration page where you can enter the public url for your Fuse Application on Openshift that you have just created, e.g restapitest-ossmentor.rhcloud.com and click on “Update & test.” This will test your set up against the 3scale sandbox proxy. The sandbox proxy allows you to test your 3scale set up before deploying your proxy configuration to AWS.


Step 3: The next step is to set up the API methods that you want to monitor and rate limit. You will do this by creating Application Plans that define which methods are available for each type of user and any usage limits you want to enforce for those users. You can get there from the left hand menu by clicking Application Plans.

and clicking on one of the Application Plans set up by default for your account. In this case we will click on “Basic.”

Which will take you to the following screen where you can start creating your API methods

for each of the calls that users can make on the API:

e.g Get Customer for GET and Update Customers for PUT / etc…


Step 4: Once you have all of the methods that you want to monitor and control set up under the application plan, you will need to map these to actual http methods on endpoints of your API. We do this by going back to the Integration page and expanding the “Mapping Rules” section.



And creating proxy rules for each of the methods we created under the Application Plan.

Once you have done that, your mapping rules will look something like this:



Step 5: Once you have clicked “Update and Test” to save and test your configuration, you are ready to download the set of configuration files that will allow you to configure your API gateway on AWS. As an API gateway we use an high-performance and open-source proxy called nginx. You will find the necessary configuration files for nginx in the same Integration page, by scrolling down to the “Production” section




The final section will now take you through installing these configuration files on your Nginx instance on Amazon Web Services (AWS) for hosting.

Part 3: Amazon Web Services (AWS) Setup


We assume that you have already completed these steps:
  • You have your Amazon Cloud account. 
  • You have created your application and are ready to deploy it to Amazon Cloud. 
  • You have created your proxy on 3scale. 
With that accomplished we are ready to setup our Amazon Cloud Server and deploy our application.

STEP 1. Open Your EC2 Management Console

Screen Shot 2014-12-29 at 1.10.25 PM.png

In the left hand side bar you will see “AWS Marketplace”. Select this, type 3scale into the Search and you will see the 3scale Proxy AMI (Amazon Machine Image) show up in the results. The 3scale Proxy AMI implicitly uses and runs an nginx gateway.

Screen Shot 2014-12-29 at 1.17.07 PM.png

Click “Select”

Screen Shot 2014-12-29 at 5.04.48 PM.png



Click “Continue”

Screen Shot 2014-12-29 at 5.06.24 PM.png



Select plan that is most appropriate to your application and then you can either select “Review and Launch” if you want a simple launch with 3scale or “Next: Configure Instance Details” to add additional detail configuration; such as shutdown, storage and security.

Screen Shot 2014-12-29 at 5.47.00 PM.png



And click “Launch”. The next screen will ask you to create or select an existing public private key.

Screen Shot 2014-12-29 at 5.57.48 PM.png
If you already have a public-private key you created on AWS can choose to use it.

If you do not already have a public-private key pair you should choose to create a new pair.

Screen Shot 2014-12-30 at 6.44.04 PM.png

Your 3scale proxy is now running on AWS.  But now we need to update the 3scale AWS instance with the NGINX config.  From 3scale download the nginx config file and upload it to AWS. Once uploaded and placed in the correct directory then restart your proxy instance.  Upload instructions are found at http://www.amazon.com/gp/help/customer/display.html?nodeId=201376650  The instructions below help you manage your proxy.

  1. head over to the your AWS Management Console and go into the running instances list on the EC2 section.
  2. check that your instance is ready to be accessed. That is indicated by a green check mark icon in the column named Status Checks.
  3. click on over the instance the list to find its public DNS and copy it
  4. log in through SSH using the ubuntu user and the private key you chose before. The command will look more or less like:
  5. ssh -i privateKey.pem [email protected]
  6. once you log in, read the instructions that will be printed to the screen: all the necessary commands to manage your proxy are described there. In case you want to read them later, these instructions are located in a file named 3SCALE_README in the home directory.
Note: Remember that the 3Scale instance runs on Ubuntu on Amazon.  Hence the ubuntu login.

In the next section, we will show how your API and API Management can be tested.

Part 4: Testing the API and API Management



Use your favorite REST client and run the following commands

1. Retrieve the customer instance with id 123

http://54.149.46.234/cxf/crm/customerservice/customers/123?user_key=b9871b41027002e68ca061faeb2f972b
2. Create a customer

http://54.149.46.234/cxf/crm/customerservice/customers?user_key=b9871b41027002e68ca061faeb2f972b

3. Update the customer instance with id 123

http://54.149.46.234/cxf/crm/customerservice/customers?user_key=b9871b41027002e68ca061faeb2f972b

4. Delete the customer instance with id 123

http://54.149.46.234/cxf/crm/customerservice/customers/123?user_key=b9871b41027002e68ca061faeb2f972b

5. Check the analytics of the API Management of your API

If you now log back in to your 3scale account and go to Monitoring > Usage you can see the various hits of the API endpoints represented as graphs.
Usage_-_Index___3scale_API_Management.png
This is just one element of API Management that brings you full visibility and control over your API. Other features are:
  1. Access control 
  2. Usage policies and rate limits 
  3. Reporting 
  4. API documentation and developer portals 
  5. Monetization and billing 
For more details about the specific API Management features and their benefits, please refer to the 3scale product description.

For more details about the specific Red Hat JBoss Fuse Product features and their benefits, please refer to the Fuse Product description.

For more details about running Red Hat JBoss Fuse on OpenShift, please refer to the xPaaS with Fuse on Openshift description.