Add message tail option "-mt",
Add MQQueueManager() auto retry.
This commit is contained in:
parent
c03202827e
commit
f3b64d8cc5
55
MQSLoad.java
55
MQSLoad.java
@ -1,7 +1,7 @@
|
||||
// $RCSfile: MQSLoad.java,v $
|
||||
// $Revision: 1.6 $
|
||||
// $Revision: 1.7 $
|
||||
// $Name: $
|
||||
// $Date: 2002/05/06 09:52:24 $
|
||||
// $Date: 2002/05/21 15:06:27 $
|
||||
// $Author: giberta1 $
|
||||
|
||||
/*
|
||||
@ -35,7 +35,7 @@ import java.text.*;
|
||||
|
||||
public class MQSLoad
|
||||
{
|
||||
private MQQueueManager QMng;
|
||||
private MQQueueManager QMng = null;
|
||||
private String QMng_Name = "";
|
||||
private MQQueue MsgQ;
|
||||
private String MsgQ_Name;
|
||||
@ -43,6 +43,7 @@ public class MQSLoad
|
||||
private String File_Name;
|
||||
private String Field_Break = "";
|
||||
private String Message_Break = "\r\n";
|
||||
private String Message_Tail = "";
|
||||
private boolean Keep_Message_Break = false;
|
||||
|
||||
|
||||
@ -222,6 +223,18 @@ public class MQSLoad
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
else if ( args[argc].equals( "-mt"))
|
||||
{
|
||||
if( argc < ( args.length + 1))
|
||||
{
|
||||
Message_Tail = Str_Format( args[++argc]);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println( "Invalid number of command line options...");
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
else if ( args[argc].equals( "-kmb"))
|
||||
{
|
||||
Keep_Message_Break = true;
|
||||
@ -258,15 +271,27 @@ public class MQSLoad
|
||||
|
||||
private void MQSInit() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
QMng = new MQQueueManager( QMng_Name);
|
||||
// System.out.println( "QManager Open: (" + QMng + ") !");
|
||||
}
|
||||
short retry = 0;
|
||||
final short RETRY_MAX = 10;
|
||||
|
||||
|
||||
while( QMng == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
QMng = new MQQueueManager( QMng_Name);
|
||||
// System.out.println( "QManager Open: (" + QMng + ") !");
|
||||
}
|
||||
|
||||
catch( Exception Expt)
|
||||
{
|
||||
throw Expt;
|
||||
catch( Exception Expt)
|
||||
{
|
||||
System.out.print("!");
|
||||
|
||||
if( retry++ > RETRY_MAX)
|
||||
{
|
||||
throw Expt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
@ -444,6 +469,8 @@ public class MQSLoad
|
||||
if( next_message <= cur_window_size)
|
||||
{
|
||||
// System.out.println( "* Write Msg CurPos: (" + cur_pos + ")");
|
||||
output_msg.writeString( Message_Tail);
|
||||
|
||||
if( Keep_Message_Break)
|
||||
{
|
||||
output_msg.writeString( Message_Break);
|
||||
@ -508,8 +535,8 @@ public class MQSLoad
|
||||
|
||||
if( ( args.length < 2) || ( args.length > 6))
|
||||
{
|
||||
System.out.println( "Usage: MQSLoad [-fb \"field_break\"] [-mb \"message_break\"] [-kmb] <Output_MsgQueue_Name> <Input_File_Name>");
|
||||
System.out.println( " Default: Field Break: (" + Str_UnFormat( Field_Break) + ") Message Break: (" + Str_UnFormat( Message_Break) + ") Keep Message Break: (" + Keep_Message_Break + ")");
|
||||
System.out.println( "Usage: MQSLoad [-fb \"field_break\"] [-mb \"message_break\"] [-mt \"message_tail\"] [-kmb] <Output_MsgQueue_Name> <Input_File_Name>");
|
||||
System.out.println( " Default: Field Break: (" + Str_UnFormat( Field_Break) + ") Message Break: (" + Str_UnFormat( Message_Break) + ") Message Tail: (" + Str_UnFormat( Message_Tail) + ") Keep Message Break: (" + Keep_Message_Break + ")");
|
||||
|
||||
System.exit( 1);
|
||||
}
|
||||
@ -520,7 +547,7 @@ public class MQSLoad
|
||||
Arg_Parse( args);
|
||||
|
||||
System.out.println( "Output MsgQueue Name: (" + MsgQ_Name + ") Input File Name: (" + File_Name + ")");
|
||||
System.out.println( "Field Break: (" + Str_UnFormat( Field_Break) + ") Message Break: (" + Str_UnFormat( Message_Break) + ") Keep Message Break: (" + Keep_Message_Break + ")");
|
||||
System.out.println( "Field Break: (" + Str_UnFormat( Field_Break) + ") Message Break: (" + Str_UnFormat( Message_Break) + ") Message Tail: (" + Str_UnFormat( Message_Tail) + ") Keep Message Break: (" + Keep_Message_Break + ")");
|
||||
|
||||
MQSInit();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user