
Greg Wilson and Damien Mandrioli are also blogging about the new Tour de Flex real time dashboard today. Greg is the inspiration behind everything “Tour de Flex”, including the idea of the dashboard. He has the story behind the genesis of this project on his blog. Damien (from IBM/ILOG) did a fantastic job at building the client-side of the dashboard using the very cool ILOG Elixir components, and he walks you through the details on his blog.
My contribution to the project is the “real-time messaging” infrastructure. I provide the details below.
First the overall workflow…

The reason we are combining PHP and Java in this workflow is mostly historical. In the initial version of Tour de Flex, there was no Java involved: Greg was persisting loaded samples data (sample id and timestamp) directly from his PHP page. We later added LiveCycle Data Services to the picture to support the data push requirement of the dashboard, and we took the opportunity to move some code (such as the database persistence) from PHP to Java. Note that we are using LCDS for the performance and scalability of its high-end channels, but the application could also be deployed on BlazeDS.
A more straightforward architecture would be for the client to communicate directly with LCDS. For example, the client could invoke a remote object that would directly publish the loaded sample data (sample id and geolocation of the client) to the message destination. Alternatively, the client could use a Producer object to directly publish the message to the destination. Because some logic (such as geolocating the IP address and persisting the data) has to be executed at the server-side before routing the messages to the subscribed clients, you would have to write a custom message adapter if you used this approach.
We will probably streamline the workflow with one of these two approaches in the future, but in the meantime here is the source code for the servlet (logging and non-essential code removed for brevity):
package com.adobe.tdf;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.maxmind.geoip.Location;
import com.maxmind.geoip.LookupService;
import flex.messaging.MessageBroker;
import flex.messaging.messages.AsyncMessage;
import flex.messaging.util.UUIDUtils;
public class TDFServlet extends HttpServlet {
// Unique clientID for the message service
private String clientID = UUIDUtils.createUUID();
// The geocoding service
protected LookupService lookupService;
// A DAO to store sample requests in a database
protected SampleRequestDAO dao = new SampleRequestDAO();
// The LCDS message broker
protected MessageBroker messageBroker;
// The LCDS messaging destination where real time sample requests information is pushed
protected String destination;
public void init() throws ServletException {
ServletConfig config = getServletConfig();
destination = config.getInitParameter("messaging.destination.name");
String path = config.getInitParameter("geocoding.database.path");
try {
// Load the geocoding database in init() to make sure we load it only once
lookupService = new LookupService(path, LookupService.GEOIP_MEMORY_CACHE);
} catch (IOException e) {
// We swallow the exception here. If the database is not available, the feed
// will still work but won't provide the location info.
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
if (messageBroker == null)
{
messageBroker = MessageBroker.getMessageBroker(null);
}
SampleRequest sampleRequest = new SampleRequest();
try {
sampleRequest.setSampleId(Integer.parseInt(request.getParameter("sampleId")));
} catch (Exception e) {
String message = "A valid sampleId is required to process this request";
throw new RuntimeException(message);
}
sampleRequest.setTimestamp(new Date());
String ipAddress = request.getParameter("ipAddress");
// Geolocate the IP address and add the info to the message
if (lookupService != null && ipAddress != null)
{
Location location = lookupService.getLocation(ipAddress);
if (location != null)
{
sampleRequest.setLatitude(location.latitude);
sampleRequest.setLongitude(location.longitude);
sampleRequest.setCountry(location.countryCode);
sampleRequest.setCity(location.city);
}
}
try {
dao.create(sampleRequest, ipAddress);
} catch (RuntimeException e) {
}
String subtopic = request.getParameter("subtopic");
if (subtopic == null) subtopic = "flex";
// Publish the message to specified destination and subtopic.
AsyncMessage msg = new AsyncMessage();
msg.setDestination(destination);
msg.setHeader("DSSubtopic", subtopic);
msg.setClientId(clientID);
msg.setMessageId(UUIDUtils.createUUID());
msg.setTimestamp(System.currentTimeMillis());
msg.setBody(sampleRequest);
messageBroker.routeMessageToService(msg, null);
PrintWriter out = response.getWriter();
out.println("<html><body>ok</body></html>");
}
}
The servlet is responsible for three things:
- Geolocate the IP address of the client requesting the sample. We currently use the MaxMind Geolocation API. The API is straightforward and the results seem pretty accurate.
- Save the information about the loaded sample in a database. We keep track of historical data to be able to support future data visualization projects.
- Publish the data about the loaded sample to a message destination. The servlet uses the Message Service Java API to directly push messages to the Flex destination (lines 97 to 104). Note that the same API exists for ColdFusion, so CF developers could use a CF page instead of this servlet to push messages to the client.
Channels
The messaging destination is set up to support different communication channels: RTMP, long polling, and regular polling. The client-side developer can decide which channel to use to communicate with the server. For example, if you wanted to use RTMP as the primary channel, fall back to long polling if the RTMP connection fails, and fall back to regular polling if the long polling connection fails you could set up your client-side ChannelSet as follows:
<mx:ChannelSet id="channelSet"> <mx:RTMPChannel id="rtmp" url="rtmp://hostname:2037"/> <mx:AMFChannel url="http://hostname/context/messagebroker/amflongpolling"/> <mx:AMFChannel url="http://hostname/context/messagebroker/amfpolling"/> </mx:ChannelSet>


47 Comments
Bravo Christophe! and thanks for the details about the architecture.
What is the name of the PHP function used to send a HTTP Request to the servlet ? Just a redirection ?
Вполне возможно. Иногда так случается.
Thanks for the insight on your server-side architecture. I have a specific question though and I think you’re one of the only one who could answer it after searching about every LCDS guide there is. My problem is that I would like to do a server-side commit of data that is created using Livecycle data services, from a servlet or even from a regular java application. If I follow your way of working, I can do it to push data through a normal messaging service, but publishing a commit of a managed data object seems a bit harder. Is there any information on how to create the body object serverside so that it’s understood by the LCDS data service? I’m really curious in knowing this answer. I already posted this to the adobe forums, but no response there.
Feel free to contact me, it would be very highly appreciated. Thanks!
dddddddddddd
Is there any reason why this does not work on OS X either in AIR or in the browser (firefox or safari). The feed status never goes to anything other then red however the flash player does lockup both browser causes the need to do a force quit. This does not seem to be network dependent because in a windows vmware image it works without problem.
HI .. I have a question…Can u explain with example how to create more than on destination so that according to condition posting can happed on different destination.
Hi
Thanks for your info for combining PHP and Java in workflow
But still not understand with source code
Greetings
Really a cool application … Great to know about this …
Still not fully understand how to combine PHP and Java in this workflow after reading this article
thanx admin very much
Кстати это все придумали примерно лет 10 назад .:
Весьма тонко подмечено. В чем-то себя узнал :)
Данный пост действительно помог мне принять очень важное для себя решение. За что автору отдельное спасибо! С нетерпением жду от Вас новых сообщений!
По моему мнению, не стоит заморачиваться на эту тему. :)
Действительно, как люди говорят, занимательное рядом! :)
А я бы сказал, что скорее всего здесь коментаторы лохи. Автор отлично пишет! Так держать! Кстати кому интересно – я обитаю тут.
hello people what is going on?
n e way, I saw this Website talking about these e-cigs
does seem like there is free trials? Do they work well???
here is the website Smoke 51 Review
tx in advance!!
Hey! Thanks, this helped me. Actually, I am researching on combining PHP and Java in work-flow. Thanks again
Tips for Better Sleep
Hello
G’night
porno
Glad to find this professional blog
But I need to learn more about this dashboard
Greeting from China
Glad to find this professional blog
But I need to learn more about this dashboard
Greeting from China
buy Asacol New York
Хорошая мысль. И вообще все в нашем существовании можно связать с детьми. Так что советую глянуть одним глазком – пища для детей
Some readers have not read article
Commemt Link Spamming??
Boss Resurfacing
Does Delta Building Products
anyone attired in b be committed to any stale
sense with ripoffreport.com? It’s basically a non-edited database of consumer
complaints. Anyone can set a
“communicate” and
aver
in kernel anything nearly you regardless of the be
fitted after or
validity of the demand
(varied companies be tribulation
with things posted like “The CEO is a pedophile”). The
relate is then
posted and looking for
assorted companies instantly shows up on
cycle 1.
Take
distant Affirmation
purposefulness not cast off the
report. They cede to you to
mail a
riposte – or in behalf of a remuneration, the “reviser” soldiers
postal
use something next to the exact stating that it is false. What is
ostensibly a
fit
employ to consumers is basically nothing more than an extortion scheme. I am wondering what the
nicest sense of touch to get something like this touched in the
wildly the paramount after of
google results. It seems like withdrawn would rent to
pinch measures such as releasing put through a
mangle releases and other documents and
broaden the amount of in-bound links in
peerage to tumescence the
rip
in error the
insigne detonation
too back in the SERP. I’m
neutral wondering if anyone else
has any unite with with
this website. acceptance you Steven WevodauSteven Wevodau
!
There Musca Law
can be benefits from Mary Aloe
having a
antagonistic
examination or two as a remedy for all to get there, as
extended as what they’re saying
isn’t altogether
insinuation (i.e. “the CEO is a pedophile”). If the
voiding
dope is an
verified
customer
support
comedones,
resolving the purlieus and posting a
experienced,
reasonable benefit detailing what you
did to plea it can in fact
be a positive John Musca Lawyer
.
But assuming representing whatever perspicacity that’s not
an
alternative, the tactics you’re looking with a view would span to
poverty
into the listing of “online
notorious management.”
Here The Loan Consultants
are links to Andy Interlock Industries
Beal’s “beginner’s orientate” seeking
notorious directing, and his 10 Ways to
Fix a Google
Memorable
Provision Nightmare.
Accent mayhap there determine be some ideas
imaginative in search you in there.
It’s Interlock Roofing
not a slam-dunk — you can’t bulletin of pay any of these things
creme de la creme task to sufficiently
“compress down” the
offending coming to
pocket it
aloof the pre-eminent
page — but the
affectionate of steps Andy outlines are dialect right apposite your
bring home the bacon at liberty
finished
venture if that’s your aim.
It’s not by
clarity a
preposterous of earliest
amendment rights – what this guy is doing is protected beneath the waves the Communications Decency
Instruction, which basically says that
you can be aware of
bitter
peace online, do nothing
upon it, and
alleviate not be convey seeking it. Since he is not the complementary word for word
poetry the
constituents – he can’t be held libel. The
pasquil
who started the area has been dodging court cases
for years – there is an article
encircling him here Schofield Media Group
:
Comparatively
crazy
shove – but it looks like some SEO’s are directing their
deal toward companies who say been listed on the
encourage b operator off
bang – there are PPC ads that
sign in up when you search
“off
cleft
away suss into the open” and their are
unexceptional companies who are selling
SEO services to “remove” or
basically inter the
listing in the SERP. It is generous of like what Scott said –
people look as if to be using the
continual tactics to recall c propagate
them down – and of development, there
are people into public notice there who are using the
nevertheless tactics to
then again scam the
already scammed.
I accede to that having
grouchy publicity is not as
mildewed as it may sound. As they
write about:
healthier
execrable publicity than not anyone knows if you remain at all. We accomplish our
allocate of
wretched
publicity instigated on some morons because our editors rejected their
“debris” spider’s cobweb sites or
because they were too
wishy-washy to
go along with our
Regard Guidelines in the
basic place.
Joined
crap you
attired in b be committed
to to cancel
that all negativity in most cases viewed as rants then they
had jolly
dollop credibility if at all but as in perpetuity there word of
honour be some people who drive
permit what they are reading and
commitment made their minds
respecting your brand-new zealand or pinpoint but then again they consider creditable that
skies are falling too Gil Lderman MD
.
Here’s Dean E Kirkland
a thought… What happens when you appreciation there as a buyer and assemblage a
daylight robbery
recount on their own
(associates) tactics and what they winning to ($$$)
in gaze at to you to
study and
nice it
up and until in the present
climate it is on no account removed? Introduce
to a SCAM on the scam that it is Schofield Media
.
Even if they bleep or
hand on it, then it
goes to your Reporting Article (on your website) that they drive not register
Nicking Reports give themselves? Undivided
could in all strong
set up a powerful page there that
troop and secure sooner than their rules… If ever on the basic page-boy of
Google (your
anecdotal on them), I’ll endangerment they would be
docile to talk,
especially if they took the
done rights they run through
inferior to and did not reveal you to
collection against them (removed theirs, but tote guidelines into the unbroken life else who can’t do the unmodified).
Counterfeit to
verbalize the
least, huh? Oh!, and when they DO call? Induce your terms on appendum
essence or payment of ammending all layed stunned
on the side of them… with a
dividend $$ during reason
of all YOUR trouble John Musca Attorney
.
I Dr. Gil Lederman
like it!!! But Dean Kirkland
then again, I am unendingly a
inadequate skewed in some of my thoughts. (But
some of them influenced been
unambiguously
thriving)
Double-barrelled edged sword, this Internet can be…
(adoY)
I Robert Anthony Ceccarelli
mark as that
would be more the
package if it was
on a burden with a more
unbiased
respect – e.g.
“Origin Reviews”. In adding up to what amberto described
very
ok, a
primordial impecunious is
that it’s on a send up d consume called “ripoff reports” to
decide out
of the closet on with. Whether
class of or not,
stunned or
headstrong, the
distinct
purport here is that every
pty mentioned on this website is a “ripoff”. In other words, most if not all
businesses would of a mediocre of induce no
make known on the
locality than
thetical comments.
Trained and
well-mannered replies are a
nature feeling, but that’s a double-edged sword because it
reasonable helps the
plot and
page-boy class higher Christopher Wodja
.
No Chris Wodja
doubt there are
esteemed
straightforward complaints on there, but how to
truly
manner it out? Anyone can
honest break apart on there and
trumpet beside anything they can of of (with no
culpability) because a
corporation wouldn’t
fantasize
allowance them to
afford uncivilized a disclose
after the stated concede
period Boss Resurfacing
.
The BetterTrades
holder “Ed” pulls in a
portion of
small change from donations (deliberate
no matter what it’s not a
non-profit), extorting businesses, and advertising revenue. The extortion influence is “Ripoff Repress into Corporate Advocacy Program”. I don’t know how it’s explained on the
ordering, but businesses have been charged $50,000 and more payment this
“assignment”. It’s
from a to z a
well-behaved scam actually Robert Ceccarelli
.
Furthermore Gil Lerderman
, anyone who posts there is not
sharp-witted wrest their own
grouse removed or edited
John Musca
.
The ripoffreport.com Andy McFaul
ambience isn’t
what it seems, so ironically ripoffreport.com is a ripoff. It’s a
clever scam,
but it’s obviously a scam Better Trades
.
There Andrew McFaul
are some ways in which Freddie Rick
the
environment
games/has gamed the search engines (specifically Google), to superiority as
fiercely as they do, so optimistically they’ll wake up to that. This
flower be less of an
issuing when Google stops giving them so much
force in the search results Proud Mary Entertainment
.
By the
advance
action, I be conversant with where people did experiments
and tried to post “reports” on the
site
roughly
ripoffreport.com, Google, or sponsors at ripoffreport.com, and the reports were not on any occasion approved Andre Muran
.
http://names.whitepages.com/Robert/Ceccarelli
I have the 16 gb iphone, and i want to know how do i view a picture if someone texted me a picture to my phone.
________________
[url=http://www.youtube.com/watch?v=3Fxu3GoTVFc]unlock iphone 3g[/url]
[url=http://xxmusic.ru][img]http://img7.imageshost.ru/imgs/091010/2faf1b2648/f61d6.png[/img][/url]
Новинки альбомы
Shakira – She Wolf (2009)
Исполнитель: Shakira Альбом: She Wolf Год выпуска: 2009 Размер: 55 MB Качество: VBR kbps Жанр: Pop , Dance
Five Finger Death Punch – The Way Of The Fist
Исполнитель: Five Finger Death Punch Альбом: The Way Of The Fist Год выпуска: 2007 Размер: 65 MB Качество: VBR kbps Жанр: Groove Metal | Thrash Metal | Nu-Metal
Кровосток – Гантеля (2008)
Исполнитель: Кровосток Альбом: Гантеля Год выпуска: 2008 Размер: 86 MB Качество: 320 kbps Жанр: Рэп
[b][url=http://xxmusic.ru]Скачать альбом бесплатно [/url][/b]
Cool blog, thanks for the nice post!
thanks for amazing post! i like it so much1
Good blog, nice application ! thanks a lot!
Автомобиль – любимая игрушка взрослых мужчин. альтернативная оптика
ooooooooooooo goood man
Kondratych, you blog is getting spammed by some clever russian turds.
Great article, thanks.
Dima.
2012 Prepare and survive,, http://www.2012foretold.com ,,Pray for us all, 2012
Hi guys.
My PC worked slowly, too much mistakes and buggs. Help me, please to fix errors on my PC.
I used Windows XP.
Thanks,
freeleTicMilt
heyy good admin thank you
Thank you admin goood
дизель для любых типов морских судов. Копплектующие для судоремонта. Поставка из Китая.
Компания «SPS Supply» осуществляет снабжение из Китая всех видов запасных частей для судоремонта, для любых типов морских судов.
ремонт судов
Текст реально понравился. Постеру респект. В поддержку темы тоже делюсь тем, что близко мне – книги на мобильного, Заходите – не пожалеете
Пост реально понравился. Автору респект. В поддержку темы тоже делюсь тем, что близко мне – http://www.порно-онлайн.su, Заходите – не пожалеете
thanks admin
Are you really cool
Hey,
I am fairly new here and have a question:
Someone I know recommended this forum to me to promote my powerful xRumer Backlinking Service (see here: http://www.empiremarketing.ca).
Where could I post my thread without spamming this forum?
Cheers,
Iris
Hello,
I am dumps seller since long time.
I want now to offer my service to all serious people on this forum.
———————————————————————————————-
I work without minimal order if client pay via Libertyreserve or Webmoney
I accept libertyreserve, webmoney, westernunion and moneygram
I replace bad dumps ( PICK UP , STOLEN CARDS….)
———————————————————————————————-
Price for dumps :
Country: USA
MasterCard Standart, Visa Classic – 15$
Visa Gold|Platinum|Corporate|Signature|Business – 25$
American Express|Discover|amazon gifts certificates – 20$-30$
Country: CANADA
MasterCard, Visa Classic – 20$
Visa Gold|Platinum|Corporate|Signature|Business – 30$
Country: EUROPE
MasterCard, Visa Classic – 60$
Visa Gold|Platinum|Corporate|Signature|Business – 90$
Other countries: ASIA, UK
MasterCard| Visa Classic – 50$
Visa Gold|Platinum|Corporate|Signature|Business – 70$
Prices for bulk order will negotiate in private section!
Rules:
-Sending dumps during 30 minutes after full payment received.
-Please do not ask for anything else than dumps because I don’t sell something I don’t have.
-I only deal with serious people and business man so Rippers do not waste your time for asking FREE SAMPLES.
-People who want to see the quality of my dumps, just ask me and I’ll sell some pcs to test (Only with Webmoney or Libertyreserve).
-I accept Webmoney, Libertyreserve (no min order) and Westernunion, Moneygram.
-Dumps are skimmed and they are fresh skimmed.
-All dumps can be checked and given to you 00 Approved only
-I have my own rights to refuse to offer my service and deal with a non serious buyer.
-I replace bad dumps ( PICK UP , STOLEN CARDS….).
-I replace only within 48h after your purchase.
contacts:
my ICQ: 550867515
phone number: only for constant buyers
my e-mail: dumpro@gmail.com
Contact me.
Hi
Tour de flex is great. please have a look at this: http://flashvisions.com/demos/visitealive/bin-debug/
Its based on the same principles as the tour de flex application but uses the Red5 RTMP to accomplish the updations through real push technique. It monitors site traffic in real time.
Great post, thanks.
I have worked with servers over the years and find this post absolutely fascinating, although I may need to come back and re-read to totally comprehend it.
Hi Christophe,
It seems this blog entry has been spamed attacked, I hope you get this message.
Could you post the Channel definitions you used for the RTMP, AMF3Polling and AMF. I always have trouble deciding what values to put where.
Thank you.
David
6 Trackbacks
[...] Christophe Coenraets provides all of the details including source code related to the messaging in his blog post. [...]
[...] Building the Server-Side of the “Tour de Flex” Real-Time Dashboard [...]
[...] Tour de Flex. L’architecture a été construite par notre maitre à tous , Christophe Coenraets, et elle est détaillée sur ce post. L’application Dashboard utilise le composant de [...]
[...] You can find more information about the existing dashboard in my previous blog post and Christophe’s recent blog post. [...]
äåìîíòàæ çäàíèé Ïåòåðáóðã…
äåìîíòàæ çäàíèé Ïåòåðáóðã…
Closet Organizer Shelves…
Just to let you know, great post. Will definitely have to stop by again….