ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » how to put a file in a queue using java

Post new topic  Reply to topic Goto page Previous  1, 2
 how to put a file in a queue using java « View previous topic :: View next topic » 
Author Message
mq_smart
PostPosted: Tue Oct 11, 2005 7:38 am    Post subject: Reply with quote

Acolyte

Joined: 30 Aug 2005
Posts: 57
Location: Vizag India

Hi Kalyan I am sending program for how to put the message in a queue.here in the program i am putting helloworld
message to the queue manager QM3 in queue Q3 with port no 1417. u can try by changing these


// MQSeries Client for Java sample To Write Message on
// in System Default Local Queue of Specified QueueManager
// Include the MQSeries classes for Java package
import com.ibm.mq.*;
public class WriteToQueue
{

public static void main(String args[])
{

// Set up MQSeries environment
// define the name of your host to connect to
// repalce "localhost" with the machine name on which QueueManger is residing
MQEnvironment.hostname = "localhost";
// define name of channel for client to use
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
// define port number on which QueueManager is listining
MQEnvironment.port=1417;
// Set TCP/IP or server Connection
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);
// define name of queue manager object to connect to.
// replace the "QM1" with your QueueManagerName
String qManager = "QM3";
// define a queue manager object
MQQueueManager qMgr;
try
{
// Create a connection to the queue manager
qMgr = new MQQueueManager(qManager);
// Set up the options on the queue we wish to open...
// Note. All MQSeries Options are prefixed with MQC in Java.
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT ;
// Now specify the queue that we wish to open, and the open options...
// default q manager ,no dynamic q name ,no alternate user id
MQQueue system_default_local_queue =qMgr.accessQueue("Q3",openOptions,null,null,null);
// Define a simple MQSeries message, and write some text in UTF format..
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Hello World!");
// specify the message options...
// accept the defaults,same as MQPMO_DEFAULT constant
MQPutMessageOptions pmo = new MQPutMessageOptions();
// put the message on the queue
system_default_local_queue.put(hello_world,pmo);
// Close the queue
system_default_local_queue.close();
// Disconnect from the queue manager
qMgr.disconnect();
} // end of try block
// If an error has occurred in the above, try to identify what went wrong.
// Was it an MQSeries error?
catch (MQException ex)
{
System.out.println("An MQSeries error occurred : Completion code " +ex.completionCode +" Reason code " + ex.reasonCode);
} //end of catch MQException
// Was it a Java buffer space error?
catch (java.io.IOException ex)
{
System.out.println("An error occurred whilst writing to the message buffer: " + ex);
} //end of catch IOException
} // end of main()

} // end of WriteToQueue


try it
_________________
Thanks in Advance

ONE life LIVE it KING size....
Back to top
View user's profile Send private message Send e-mail
PeterPotkay
PostPosted: Tue Oct 11, 2005 6:16 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

hopsala wrote:
Besides, it's a whole new world, and as it turns out, free volunteer software tends to have better support than official products; for example MS03 WMQ object backup failed - that's better+faster support than any company will ever give you.


Word up G.

MO71 support by Mr Clarke kicks arse to.

Send them an email and its like opening a Sev1 pmr and immediatly escalating it.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
railkars
PostPosted: Tue Oct 25, 2005 6:00 am    Post subject: AMI - upgraded support pac - MA0F - 10/21/2005 Reply with quote

Novice

Joined: 19 Nov 2003
Posts: 12

Folks,

Take a look at the upgrade available from IBM - AMI

http://www-1.ibm.com/support/docview.wss?uid=swg24000641

I have not used it, but have been doing some research on it. Apparently IBM is bringing this back to support their ESB.

Anyone who has used AMI previously, please shed some light on how the Java sample program would be used instead of the famous 'Q' program. I have installed the support pac and created the Service point and the policy, but how do I call the sample programs.....is there an easier way than to read the whole pdf doc.

Thanks.
_________________
Shobha Railkar
Back to top
View user's profile Send private message MSN Messenger
jefflowrey
PostPosted: Tue Oct 25, 2005 6:09 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Quote:
IMPORTANT NOTE
After June 2003, IBM has no plans to enhance the AMI with any new functions or platforms. IBM will however continue to support the AMI as described in the Technical Support sectioin below.

We would recommend that customers do not use the AMI for any new projects and do not extend usage in existing projects. This recommendation does not apply to functions shipped by other IBM products, such as DB2, that have made use of the AMI. IBM is working to ensure that these products are able to provide the same functionality as today without the AMI.


My emphasis.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
hopsala
PostPosted: Tue Oct 25, 2005 6:37 am    Post subject: Reply with quote

Guardian

Joined: 24 Sep 2004
Posts: 960

railkars wrote:
Apparently IBM is bringing this back to support their ESB.

Are they? I haven't heard anything of the such; what have you heard? Can you supply a link to support these claims?
Back to top
View user's profile Send private message
Krishna_Bhaskar_Vonteddu
PostPosted: Tue Oct 25, 2005 6:51 am    Post subject: Hai Kalyani this snippet may help u Reply with quote

Novice

Joined: 05 Sep 2005
Posts: 11

import com.ibm.mq.*;
import java.io.*;
public class MQPut
{
public static void main(String args[]) throws Exception
{
System.out.println("MQPutDemo started...");

MQQueueManager qMgr = new MQQueueManager("Qmgr_name");
String queueName = "Queue_name";
MQMessage myMessage = new MQMessage();

MQPutMessageOptions pmo1 = new MQPutMessageOptions();
pmo1.options = pmo1.options|MQC.MQPMO_LOGICAL_ORDER|MQC.MQPMO_SET_IDENTITY_CONTEXT | MQC.MQPMO_SYNCPOINT ;
int openOptions = MQC.MQOO_OUTPUT | MQC.MQPMO_SET_IDENTITY_CONTEXT ;
MQQueue myQueue = qMgr.accessQueue(queueName ,openOptions,null,null,null);


File f = new File(args[0]); //give the path of the file
FileInputStream fis = new FileInputStream(f);
long length = f.length();
byte[] bts = new byte[(int)length];
fis.read(bts);
fis.close();

myMessage.write(bts);

myQueue.put(myMessage, pmo1);
myQueue.close();
qMgr.disconnect();
}
}
Back to top
View user's profile Send private message
railkars
PostPosted: Tue Oct 25, 2005 8:06 am    Post subject: Reply with quote

Novice

Joined: 19 Nov 2003
Posts: 12

Thanks, Krishna.


Hopsala, Wrong assumption.

Jeff, Thanks for bringing to attention the fine print ....



I was however thinking of this article ....

Benefits of an enterprise service bus

Today's fast-paced business world demands the ability to change and adapt rapidly. An enterprise service bus can enable you to integrate your business applications and processes quickly and easily, allowing you to respond to business challenges and opportunities as soon as they arise. An implementation of an ESB can improve operational performance and reduce costs while simplifying the task of connecting dissimilar applications across a network of different operating systems. Wherever you are starting from, IBM can provide the capabilities and supporting tools you need to implement an ESB — today.
Potential IT Benefits:

Create additional value from existing applications and information
Quickly add best-of-breed applications
Reduce the total cost of ownership through a standards-based service-oriented architecture (SOA)
Quickly respond to changing value-chain requirements
Leverage existing assets in new ways
Simplify complex programming tasks
Reduce software development and maintenance cost
Improve system security, scalability, availability and robustness
_________________
Shobha Railkar
Back to top
View user's profile Send private message MSN Messenger
EddieA
PostPosted: Tue Oct 25, 2005 8:23 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
I was however thinking of this article ....

And where in that article does it mention AMI as part of this Grand Plan.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
railkars
PostPosted: Tue Oct 25, 2005 9:36 am    Post subject: Reply with quote

Novice

Joined: 19 Nov 2003
Posts: 12

Wrong assumption
_________________
Shobha Railkar
Back to top
View user's profile Send private message MSN Messenger
jefflowrey
PostPosted: Tue Oct 25, 2005 9:41 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

railkars wrote:
Wrong assumption


So, what, you didn't claim that IBM was brining back AMI for use with ESB?

railkars wrote:
Take a look at the upgrade available from IBM - AMI

http://www-1.ibm.com/support/docview.wss?uid=swg24000641

I have not used it, but have been doing some research on it. Apparently IBM is bringing this back to support their ESB.


Then what is the correct assumption here?

What was your point in mentioning this support pack, in a fairly inappropriate thread?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
railkars
PostPosted: Tue Oct 25, 2005 10:15 am    Post subject: Reply with quote

Novice

Joined: 19 Nov 2003
Posts: 12

Jeff,
I was looking for Java based file transfer API. When I receivd the IBM Support Technical Information Notification this morning, and I saw AMI, I thought I could use it. I did not realize that it was upgrade to old Support Pac which IBM has discouraged customers from using. On the other hand, reading a lot about SOA and ESB, I assumed that IBM may be bringing this back into picture. I stand corrected.
The thread is not inappropriate, for it did start with the JAVA file transfer interest, and AMI is able to handle that process. Somewhere along the line, solutions were tabled to use PM4DATA, MA01 and AMI, all positive guidance that came out of this thread.
_________________
Shobha Railkar
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » IBM MQ API Support » how to put a file in a queue using java
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.