Monday, March 30, 2009
Nexenta- alive again...
Thursday, March 26, 2009
Using Java Messaging Service On Spring Framework
Special thanks to Siddharth for all the help!
I will demo a simple JMS that runs on JBOSS application server, uses point to point communication and sends and receives a simple text message.
You will need a message sender class, message receiver class and a simple servlet to invoke the app via the web.
Here's the source code for each.
This is what the message sender class looks like..
package com.JMSapp.SendNReceive;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.Session;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
public class QueueSender{
private JmsTemplate jmsTemplate;
public void setJmsTemplate(JmsTemplate jmsTemplate){
this.jmsTemplate = jmsTemplate;
}
public void sendMesage(){
jmsTemplate.send(new MessageCreator(){
public Message createMessage(Session session) throws JMSException{
MapMessage message = session.createMapMessage();
message.setString("test", "WhitenoiZ rocks!!!!!Say what, say what!!");
return message;
}
});
}
}
Here's what the message receiver class looks like..
package com.JMSapp.SendNReceive;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageListener;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.support.JmsUtils;
public class TestMessageListener implements MessageListener{
private JmsTemplate jmsTemplate;
public void setJmsTemplate(JmsTemplate jmsTemplate) {
this.jmsTemplate = jmsTemplate;
}
public void onMessage(Message message){
MapMessage mapMessage = (MapMessage) message;
try {
System.out.println(mapMessage.getString("test"));
}catch (JMSException e) {
throw JmsUtils.convertJmsAccessException(e);
}
}
}
and here's the servlet..
package com.JMSapp.SendNReceive;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
public class QueueSenderServlet extends HttpServlet
implements javax.servlet.Servlet{
/**
*
*/
private static final long serialVersionUID = 1L;
protected void service(HttpServletRequest request,HttpServletResponse response) throws ServletException,
IOException{
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext());
QueueSender sender = (QueueSender) ctx.getBean("jmsSender");
sender.sendMesage();
}
}
You will need an applicationContext.xml file under the WEB-INF directory in your project. Here's what that looks like..

Here's my web.xml

Optionally, you can also a have a log4j.xml file if you need logging but for the sake of simplicity, I will leave that out here...
You will also need to reference the following jar files in your project's classpath.
commons-lang-1.0.1.jar
commons-logging.jar
junit.jar
spring.jar
servlet-api.jar
jms.jar log4j-1.2.14.jar (if you are using logging)
That's it!
Now you can clean and build your project..
And then to deploy it as a WAR file, follow the following steps..
I am using Eclipse IDE so here' the steps I followed.
Right click your project name under Package Explorer in Eclipse, click on Export..
Select filesystem,
expand your project, select only WEB-INF and bin and type in the location where you want to export the files to.
I am exporting it straight to the JBOSS application server folder.
Here's the path I am using. (Linux system running on Fedora 8)
/home/moncy/jboss-4.2.1/server/JMStest/deploy/test.war
Then navigate to the test.war file, rename the "bin" folder to "classes" and drag it into the WEB-INF folder.
Then start JBOSS..
[root@maverick ~]# run.sh -c JMStest --host localhost
Note: JMStest is an exact copy of the default folder under JBoss..I made this to make sure I don't accidentally screw up something in the default implementation.. :)
and here's the sample output..Double click to view a bigger image..as you can see in the sample output, WhitenoiZ does rock! :)

Any mods/flak/improvements/constructive criticism/advice/doubts/chocolates/dead rats by snail-mail welcome..Will be glad to answer you all!
email me at mark.moncy@gmail.com
Cheers,
Monzta
Saturday, December 27, 2008
Jingle bombs in Israel
Overnight, the IDF launched a series of aistrikes at Hamas targets to try to stop the missile and rocket onslaught. One report indicates that Israeli warplanes fired upwards of 30 missiles at Hamas targets. Israel’s Channel 2, however, reported that “60 planes were involved in the attack, and nearly 100 targets were hit.” Hamas leaders say at least 150 Palestinians were killed in the airstrikes, and some 300 were wounded. Those casualty figures have not, however, been verified as of 10am eastern time Saturday. Hamas leaders declared, “This is war!” Other Hamas leaders are vowing to “unleash Hell” on Jewish Israelis.
Israeli officials are threatening a full ground invasion of Gaza if the rocket attacks from Hamas don’t end. A new poll finds that 60% of Israelis support an invasion to stop the rocket attacks.
Israeli Foreign Minister Tzipi Livni — currently running for Prime Minister in the Feb. 10th elections — said in Cairo: “Enough is enough. When there’s shooting, there’s a response. Any state would react that way.” Israeli Defense Minister Ehud Barak — also running for Prime Minister — also sounded tough, saying, “whoever harms the citizens and soldiers of Israel will pay a heavy price.”
Are these threats of a full ground war for real? If so, casualties on both sides could mount quickly and a humanitarian crisis could explode. But full scale war is not a foregone conclusion. Olmert, Livni, and Barak have been threatening to invade Gaza for the last several years, as more than 6,000 rockets, missiles and mortars have rained down on some half a million Israelis living near the Gaza border. Yet they have never followed through on their threats.
This is a key message point of opposition leader Benjamin Netanyahu, who has been urging Olmert to launch an invasion and stop the violence immediately rather than merely repeat empty threats. “I do not know of a country that would be hit by this many missiles and not do anything,” Netanyahu said Wednesday. “We must stop being hit and attack in order to renew our deterrence capability and our national honor.” Netanyahu is currently leading in the polls in his own bid to be Prime Minister, in part because Israelis see him as stronger on defense than Livni and Barak. But should the current government launch an aggressive and effective assault on the Hamas terrorist infrastructure in Gaza, this could dramatically help Livni and Barak in the polls and cause Netanyahu to lose ground.
Please be praying for Israel’s current political and military leaders to have the wisdom and courage to the right thing to protect their citizens. Pray, too, that the Lord would raise of up more leaders in the Jewish State who will be like the “sons of Issachar” described in I Chronicles 12:32, men who “understood the times and knew what Israel should do.” Pray for the Israeli families who are suffering in many ways due to the relentless barrage of rocket fire from Gaza. Meanwhile, please pray for Palestinian leaders to effectively confront the Hamas radicals and shut down their terrorist operations. Please pray for all the Palestinian families who are victims of both war and terrorism. And please don’t forget to pray faithfully and consistently for evangelical Christians on both sides of the border and around the world to know how best to help Israelis and Palestinians who are caught in the crossfire and suffering as a result.
Saturday, April 26, 2008
WhitenoiZ in da house!
So WhitenoiZ hit the studios for the first time today..about time too!
It was fun and by God's grace we didn't have to do too many retakes..
most of it was recorded right the very first time itself..even the solo which i dreamt up while Ranjit "Wizard" Abraham played the sweet bridge to "Give back"..the song sounds ultra cool..or maybe it was just the big speaker effect..or maybe it was all the layers..
Pretty tired at the end of it, now I am sitting at my office desk..while the amd 64 hardy heron iso image gets downloaded and while I do some serious coding on Krell's S1000.. :)
Tomorrow video shoot at some construction site...hmmm..wonder how that will be!
Friday, April 25, 2008
p.s
I forgot to mention...compiz has more effects than before..things like
3D windows and stuff..and Netbeans v6.something works like a charm. It
installed all the OpenJK,OpenJRE and other dependencies during
installation..yeah its all open sourced now.
I have never seen Netbeans load so fast ever..not on Windows or even Gutsy..
The interface has a blue tint to it instead of brown on the old one..
Hardy Heron is here!
For those who are not micro or soft, Hardy Heron has just been
released.. i downloaded the AMD64 iso image from some server in
Oceania/Austalia..all the others were experiencing heavy loads..
The installation took only 13 minutes..2 minutes less than it took me to install Gutsy..
but the repositories seem to be gettin hammered worldwide...cant download updates :(
Compiz worked but the screen resolution does not give 1024*768..it only stops at 800*600.
must be because i used the nvidia_new driver.....should've used the old one.
Cant try it until the repos are up and running again..
in other news, WhitenoiZ hits the studios tomorrow :)
Tuesday, February 19, 2008
new agp card!!
Powered by ScribeFire.