Search This Blog

Thursday, December 17, 2009

Overview of Java Messaging


Messaging is a method of communication between software components or applications. A messaging system is a peer-to-peer facility: A messaging client can send messages to, and receive messages from, any other client. Each client connects to a messaging agent that provides facilities for creating, sending, receiving, and reading messages.


A JMS application is composed of the following parts:
A JMS provider is a messaging system that implements the JMS interfaces and provides administrative and control features.
JMS clients are the programs or components, written in the JavaTM programming language, that produce and consume messages.
Messages are the objects that communicate information between JMS clients.
Administered objects are preconfigured JMS objects created by an administrator for the use of clients. The two kinds of administered objects are destinations and connection factories.
Native clients are programs that use a messaging product's native client API instead of the JMS API. An application first created before the JMS API became available and subsequently modified is likely to include both JMS and native clients.
JMS API can be used in some of the following ways:
Consume messages asynchronously with a message-driven bean
Produce messages from an application client
Produce messages from a session bean
Access an entity bean from a message-driven bean
Produce and consume messages on more than one system
An enterprise application provider is likely to choose a messaging API over a tightly coupled API, such as remote procedure call (RPC), under the following circumstances.
The provider wants the components not to depend on information about other components' interfaces, so that components can be easily replaced.
The provider wants the application to run whether or not all components are up and running simultaneously.
The application business model allows a component to send information to another and to continue to operate without receiving an immediate response.
For example, components of an enterprise application for an automobile manufacturer can use the JMS API in situations like these:
The inventory component can send a message to the factory component when the inventory level for a product goes below a certain level so that the factory can make more cars.
The factory component can send a message to the parts components so that the factory can assemble the parts it needs.
Performs a JNDI lookup of the ConnectionFactory and Destination
Look up connection factory and destination. If either does not exist, exit. If you look up a TopicConnectionFactory or a QueueConnectionFactory
Creates a Connection and a Session:
Connection connection =   connectionFactory.createConnection(); Session session = connection.createSession(false,   Session.AUTO_ACKNOWLEDGE);
Creates a MessageProducer and a TextMessage:
MessageProducer producer = session.createProducer(dest); TextMessage message = session.createTextMessage();
Sends one or more messages to the destination:
for (int i = 0; i < NUM_MSGS; i++) {   message.setText("This is message " + (i + 1));   System.out.println("Sending message: " +     message.getText());   producer.send(message); }
Sends an empty control message to indicate the end of the message stream:
producer.send(session.createMessage());
Finally close the connection using connection.close() in the finally clause.


A sequence of how queue and topic would be used:
Queue name is jms/ControlQueue
Queue name is jms/Queue
Topic name is jms/Topic
Connection factory name is jms/DurableConnectionFactory
  SENDER: Created client-acknowledge session
  SENDER: Sending message: Here is a client-acknowledge message
  RECEIVER: Created client-acknowledge session
  RECEIVER: Processing message: Here is a client-acknowledge 
message
  RECEIVER: Now I'll acknowledge the message
PUBLISHER: Created auto-acknowledge session
SUBSCRIBER: Created auto-acknowledge session
PUBLISHER: Receiving synchronize messages from jms/
ControlQueue; count = 1
SUBSCRIBER: Sending synchronize message to jms/ControlQueue
PUBLISHER: Received synchronize message;  expect 0 more
PUBLISHER: Publishing message: Here is an auto-acknowledge 
message 1
PUBLISHER: Publishing message: Here is an auto-acknowledge 
message 2
SUBSCRIBER: Processing message: Here is an auto-acknowledge 
message 1
PUBLISHER: Publishing message: Here is an auto-acknowledge 
message 3
SUBSCRIBER: Processing message: Here is an auto-acknowledge 
message 2
SUBSCRIBER: Processing message: Here is an auto-acknowledge 
message 3 

Tuesday, April 28, 2009

Lazy-loaded tree example

mx:application mx="http://www.adobe.com/2006/mxml" layout="absolute" creationcomplete="creationCompleteHandler()"

import mx.utils.ObjectProxy;
import mx.events.TreeEvent;
import mx.collections.ArrayCollection;
private var myEvent:TreeEvent;

[Bindable]
private var acSiteTreeList:ArrayCollection;

private function creationCompleteHandler():void {
var obj:Object;
acSiteTreeList = new ArrayCollection ();
for(var i:int = 0; i < 3; i++) {
obj= new Object();
obj["type"] = "something";
obj["children"] = new ArrayCollection();
//fetch is a property in the dataprovider to check if I have fetched the child nodes previously
obj["fetch"] = false;
obj["label"] = "name " + i.toString();
acSiteTreeList.addItem(obj);
}
}

private function setView(event:TreeEvent):void {
if(event.item.type == "something" && event.item.fetch == false) {
myEvent = event; //(myEvent is of type TreeEvent)
//update the dataprovider
var obj:ObjectProxy;
var item:Object;
var children:ArrayCollection;
for(var i:int = 0; i < acSiteTreeList.length; i++) {
obj= new ObjectProxy();
obj["type"] = "something";
//obj["children"] = new ArrayCollection(bloggersArray);
//fetch is a property in the dataprovider to check if I have fetched the child nodes previously
obj["fetch"] = false;
obj["label"] = "node " + i.toString();
item = myEvent.item;
children = item.children;
item.fetch = true;
children.addItem(obj);
acSiteTreeList.itemUpdated(item);
}
}
}

mx:canvas width="100%" height="100%"
mx:tree id="treeSiteList" dataprovider="{acSiteTreeList}" x="204" y="10" height="582" width="394" itemopen="setView(event)"
mx:Canvas
mx:Application

Monday, April 20, 2009

Wowza Media Server - Really hot!

The Wowza Media Server is a upcoming, commercial alternative to Adobe's Flash Media Server with some unique features such as FastForward and Rewind.

The Wowza Media Server (WMS) is a Java 5 (aka 1.5) server application that can be extended using Java on the server side and Flash on the client side using the Flash Media Server client side ActionScript API. The software supports Live streaming (using ON2 Live), Video on Demand with Fast Forward, rewind and prepend operations, multiuser Video Chats (video, audio and text) as well as Video Recording.

This addition brings more competition to the Flash Video space where Adobe's Flash Media Server and Red5 currently represent the outer limits.

Wowza Pro10: FREE
Perfect for development and personal use, the Wowza Pro10 edition supports a maximum of 10 concurrent connections and does not have MPEG-TS ingest capabilities. Otherwise, the Pro10 edition contains the full features and functionality of the Wowza Pro Unlimited with MPEG-TS edition.

Wowza Pro Unlimited with MPEG-TS: Single License $995
The Wowza Pro Unlimited with MPEG-TS edition has no per-server connection capacity limit and is the best option for commercial deployments. While the Wowza Pro Unlimited with MPEG-TS edition does not limit the number of connections, connection capacity will depend on your choice of hardware, internet connection bandwidth and specific application.

Saturday, April 4, 2009

Adobe Flex for .NET developers

One of the announcements from Adobe’s recent annual developer conference that should be of particular interest to .NET developers is the release of a free plug-in for Microsoft Visual Studio, which provides support for building rich Internet applications (RIAs) using Adobe's Flex framework. The release of the Ensemble Tofino plug-in will be important to the many enterprise development teams that have standardized on Visual Studio as their primary integrated development environment (IDE), but who want to take advantage of the ubiquitous Flash Player for deploying a RIA.
With increasing end-user expectations in relation to the quality, expressiveness and performance of web-based applications, developers need to focus more attention on the “richness” of the user experience. Whilst AJAX-style techniques can be used to enrich the user interface, plug-in based technologies like Flash Player is extending the capabilities of the browser, to offer media playback, enhanced graphics and faster code-execution performance.
The only thing that you need to do to enable Flex development within your Visual Studio environment is to install the Ensemble Tofino plug-in, available free from http://www.ensemble.com/. At the time of writing, the plug-in is in an early stage of release, and currently includes the ability to create, compile and debug applications.

AI & UI - Thinking beyond...

Can we build code that can think on its own?
For example, can we build a component that can learn from the inputs that it gets?
I was trying to build a component that can handle additional events based on user inputs. This component can adapt to user's requirement by changing from a 2d to a 3d component on its own.
UI has come a long way and today's user's expect the UI to hold the data within it and expect the UI to "analyze" this data and display appropriate responses through data visualizations to tell the users what action to take!
Talking about 2d to 3d and vise-versa, I believe the marriage between flare and papervision could create the best of the 2d and 3d worlds!
Building a new component that takes ideas from flare and papervision and has Artificial Intelligence embedded makes it mouth watering!

Original = Light weight = High Performance

The fact of the matter is we as developers look for great open source frameworks and libraries that can make our lives easier.
The vision should always be on scalability and performance but for some reason all these free libraries are making us lose focus on the plain fact that we can build ultimate stuff that can be much better than all these that exist for free.
The problem is using these libraries limit our ability think beyond what exists!
The idea is that by creating a component on our own using simple logic creates unbelievably great stuff! All the actionscript code for 2d, 3d and data visualization are great but there is much more than we see.
All I suggest is enjoy creating stuff than just re-using the "elephants"!!!

LivePipe UI

LivePipe UI is a suite of high quality widgets and controls for web 2.0 applications built using the Prototype JavaScript Framework. Each control is well tested, highly extensible, fully documented and degrades gracefully for non JavaScript enabled browsers where possible. MIT licensed and actively maintained.

Openings Jobs in Flex, Java, Perl & C Programming

We have some openings for the following positions:

1. Strong in Java/J2EE skills with 1 to 5 yrs experience.
2. Strong C skills with 4-5 yrs experience.
3. JavaScript, AJAX and Adobe Flex with 1-4 yrs experience
4. Strong in Perl or any other scripting language. Should have worked on automated testing. Around 2-4 yrs experience in testing.
5. Designer for creating content (especially icons) for our web application, product and company website. Should be good in Photoshop, Fireworks or any other Image editor and should be very creative.

Location: Bangalore

mail your resumes to: aditya7773@gmail.com

Prototype JavaScript

Prototype is a JavaScript Framework that aims to ease development of dynamic web applications.

http://www.prototypejs.org/

Featuring a unique, easy-to-use toolkit for class-driven development and the nicest Ajax library around, Prototype is quickly becoming the codebase of choice for web application developers everywhere.

prototype.js is a JavaScript library initially written by Sam Stephenson. This amazingly well thought and well written piece of standards-compliant code takes a lot of the burden associated with creating rich, highly interactive web pages that characterize the Web 2.0 off your back.

Developers familiar with the Ruby programming language will notice an intentional similarity between Ruby's built-in classes and many of the extensions implemented by this library. That's not surprising since prototype.js is a spinoff and is directly influenced by the requirements of the Ruby on Rails framework.

As far as browser support goes, prototype.js tries to support Internet Explorer (Windows) 6.0+, Mozilla Firefox 1.5+, Apple Safari 1.0+, and Opera 9+. Supporting these browsers also cause some other browsers that share their rendering engines to be supported as well, like Camino, Konqueror, IceWeasel, Netscape 6+, SeaMonkey, etc.

Flex Data Visualization & Charting

There are some cool open source projects that are creating ripples in flex. I find the best of all to be Flare. Flare is very flexible and light-weight. It provides foundation classes to create ultimate data-visualization components with useful animations, transitions and effects.
There is another such project called BirdEye. This is pretty cool but still not as great as Flare. However the vision of this project is to create an end-to-end solution for data-visualization. Not the fun stuff that developers would like to reuse.

Flare:
Flare is an ActionScript library for creating visualizations that run in the Adobe Flash Player. From basic charts and graphs to complex interactive graphics, the toolkit supports data management, visual encoding, animation, and interaction techniques. Even better, flare features a modular design that lets developers create customized visualization techniques without having to reinvent the wheel.

BirdEye:
BirdEye is a community project to advance the design and development of a comprehensive open source information visualization and visual analytics library for Adobe Flex. The actionscript-based library enables users to create multi-dimensional data visualization interfaces for the analysis and presentation of information.

Have fun with all the cool data-visualization stuff!