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 » Problem putting data into remote queue

Post new topic  Reply to topic
 Problem putting data into remote queue « View previous topic :: View next topic » 
Author Message
raze
PostPosted: Tue May 16, 2006 3:50 pm    Post subject: Problem putting data into remote queue Reply with quote

Newbie

Joined: 16 May 2006
Posts: 3

I still have this strange problem. When writing to the remote queue the
message does not reach the other end of the remote queue.

When using the test program amqsput.exe everything works as expected,
but when using my Delphi test program, it only works when writing to a
local queue.

I get no errors what so ever from MQ. I hope somebody have an idea on
how to fix this problem ?

I'm using MQSeries client version 5.1.

----------------------------- Delphi main program
-----------------------------------------------------

unit MQSMain;

interface

uses Windows, Forms, SysUtils, StdCtrls, Buttons, Controls, Classes,
ExtCtrls, dialogs, Spin, syncobjs, registry;

{$I MQS.inc}

function BreakWriteConnectionToMQS: longint;
function MakeWriteConnectionToMQS(qm: PChar): longint;
function SendStringToMQS(s: PChar; qm: PChar; qn: PChar): longint;

var

ObjDesc: MQOD = (StrucId: ('O','D',' ',' ');
Version: MQOD_VERSION_1;
ObjectType: MQOT_Q;
ObjectName: '';
ObjectQMgrName: '';
DynamicQName: 'AMQ.*';
AlternateUserId: '';
RecsPresent: 0;
KnownDestCount: 0;
UnknownDestCount: 0;
InvalidDestCount: 0;
ObjectRecOffset: 0;
ResponseRecOffset: 0;
ObjectRecPtr: nil;
ResponseRecPtr: nil;
AlternateSecurityId: (#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0);
ResolvedQName: '';
ResolvedQMgrName: '');

Filler1: MQMD;

MsgDesc: MQMD = (StrucId: ('M','D',' ',' ');
Version: MQMD_VERSION_1;
Report: MQRO_NONE;
MsgType: MQMT_DATAGRAM;
Expiry: MQEI_UNLIMITED;
Feedback: MQFB_NONE;
Encoding: MQENC_NATIVE;
CodedCharSetId: MQCCSI_Q_MGR;
Format: (' ',' ',' ',' ',' ',' ',' ','
');
Priority: MQPRI_PRIORITY_AS_Q_DEF;
Persistence: MQPER_PERSISTENCE_AS_Q_DEF;
MsgId: (#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0);
CorrelId: (#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0);
BackoutCount: 0;
ReplyToQ: '';
ReplyToQMgr: '';
UserIdentifier: '';
AccountingToken: (#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0);
ApplIdentityData: '';
PutApplType: MQAT_NO_CONTEXT;
PutApplName: '';
PutDate: '';
PutTime: '';
ApplOriginData: '';
GroupId: (#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0);
MsgSeqNumber: 1;
Offset: 0;
MsgFlags: MQMF_NONE;
OriginalLength: MQOL_UNDEFINED);

Filler2: MQMD;

PutOptions: MQPMO = (StrucId: ('P','M','O',' ');
Version: MQPMO_VERSION_1;
Options: MQPMO_NONE;
Timeout: -1;
Context: 0;
KnownDestCount: 0;
UnknownDestCount: 0;
InvalidDestCount: 0;
ResolvedQName: '';
ResolvedQMgrName: '';
RecsPresent: 0;
PutMsgRecFields: MQPMRF_NONE;
PutMsgRecOffset: 0;
ResponseRecOffset:0;
PutMsgRecPtr: nil;
ResponseRecPtr: nil);

Filler3: MQMD;

PutMsgDesc: MQMD = (StrucId: ('M','D',' ',' ');
Version: MQMD_VERSION_1;
Report: MQRO_NONE;
MsgType: MQMT_DATAGRAM;
Expiry: MQEI_UNLIMITED;
Feedback: MQFB_NONE;
Encoding: MQENC_NATIVE;
CodedCharSetId: MQCCSI_Q_MGR;
Format: (' ',' ',' ',' ',' ',' ',' ','
');
Priority: 0;
Persistence: MQPER_PERSISTENCE_AS_Q_DEF;
MsgId: (#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0);
CorrelId: (#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0);
BackoutCount: 0;
ReplyToQ: '';
ReplyToQMgr: '';
UserIdentifier: '';
AccountingToken: (#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0);
ApplIdentityData: '';
PutApplType: MQAT_NO_CONTEXT;
PutApplName: '';
PutDate: '';
PutTime: '';
ApplOriginData: '';
GroupId: (#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0,
#0,#0,#0,#0,#0,#0,#0,#0);
MsgSeqNumber: 1;
Offset: 0;
MsgFlags: MQMF_NONE;
OriginalLength: MQOL_UNDEFINED);

Filler4: MQMD;

WriteConnHandle: longint;
WriteQueueHandle: longint;
WriteConnectionEstablished: boolean = FALSE;
WriteConnectionError: boolean = False;

implementation

function BreakWriteConnectionToMQS: longint;
var
comp_code: longint;
reason: longint;

begin
comp_code := MQCC_OK;
reason := MQRC_NONE;

Filler1 := MQMD_DEFAULT;

if ( WriteConnectionEstablished ) then
begin
MQDISC(WriteConnHandle, comp_code, reason);
if ( comp_code = MQCC_OK ) then
WriteConnectionEstablished := False
end
else
comp_code := MQCC_OK;

Result := comp_code;
end;

function MakeWriteConnectionToMQS(qm: PChar): longint;
var
comp_code: longint;
reason: longint;

begin
comp_code := MQCC_OK;
reason := MQRC_NONE;
if ( not WriteConnectionEstablished ) then
begin
MQCONN(qm, WriteConnHandle, comp_code, reason);
if ( comp_code = MQCC_OK ) then
begin
WriteConnectionEstablished := True;
comp_code := MQCC_OK;
end;
end;

Result := reason
end;

function SendStringToMQS(s: PChar; qm: PChar; qn: PChar): longint;
var
comp_code: longint;
reason: longint;
buffer_length: longint;

begin
comp_code := MQCC_OK;
reason := MQRC_NONE;
if ( WriteConnectionError ) then
begin
WriteConnectionError := False;
end;
if( not WriteConnectionEstablished ) then
begin
comp_code := MakeWriteConnectionToMQS(qm);
if ( comp_code <> MQCC_OK ) then
WriteConnectionError := True;
end;
if ( comp_code = MQCC_OK ) then
begin
StrCopy( ObjDesc.ObjectName, qn);
MQOPEN(WriteConnHandle, ObjDesc, MQOO_OUTPUT +
MQOO_FAIL_IF_QUIESCING, WriteQueueHandle, comp_code, reason);
if ( (comp_code = MQCC_FAILED) or (reason <> MQRC_NONE) ) then
begin
WriteConnectionError := True;
end
else
begin

ShowMessage('Number of open remove queues are: ' +
IntToStr(objDesc.UnknownDestCount) + ' for queue ' +
objDesc.ResolvedQName);

//StrLCopy(PutMsgDesc.Format, MQFMT_STRING,
StrLen(MQFMT_STRING));
buffer_length := strlen( s );

StrLCopy(PutMsgDesc.MsgId, MQMI_NONE_ARRAY,
StrLen(MQMI_NONE_ARRAY));
StrLCopy(PutMsgDesc.CorrelId, MQCI_NONE_ARRAY,
StrLen(MQCI_NONE_ARRAY));

ShowMessage('Ready to put msg: ' + s + ' with length: ' +
IntToStr(buffer_length));

MQPUT(WriteConnHandle, WriteQueueHandle, PutMsgDesc, PutOptions,
buffer_length, s, comp_code, reason);
if ( (comp_code <> MQCC_OK) or (reason <> MQRC_NONE) ) then
begin
WriteConnectionError := True;
end
else
Back to top
View user's profile Send private message MSN Messenger
wschutz
PostPosted: Tue May 16, 2006 4:05 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Well, if your MQPUT acutally worked, then you should check the transmission queue to see if the message is there and if it insn't then look in the local and remote qmgr's dead letter queues (it might be helpful to make the messages persistent so the qmgr doesn't thow them away on you if they can't be delivered).
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
raze
PostPosted: Thu May 18, 2006 12:52 pm    Post subject: Reply with quote

Newbie

Joined: 16 May 2006
Posts: 3

I tried making it persistent, but it still does not work.

The people in the MQ server end says that they can't find the message anywhere.

However, now when I do a connect, makes a put and then makes a disconnect, the message sometimes gets through to the receiver, but not always.

I also wonder why I get error 2050 when priority is set to default value -1.

Furthermore I wonder why KnownDestCount, UnknownDestCount and InvalidDestCount all contains the value 0 after I did a succesful put (both on local and remote queues).

Anybody have any ideas at all ?
Back to top
View user's profile Send private message MSN Messenger
Nigelg
PostPosted: Thu May 18, 2006 11:07 pm    Post subject: Reply with quote

Grand Master

Joined: 02 Aug 2004
Posts: 1046

Quote:

Anybody have any ideas at all ?


Yes, your app has at least one bug which is causing it not to work as you expect. Inspect the code until you find the bug, then fix it.
_________________
MQSeries.net helps those who help themselves..
Back to top
View user's profile Send private message
raze
PostPosted: Sun May 21, 2006 2:01 pm    Post subject: Reply with quote

Newbie

Joined: 16 May 2006
Posts: 3

I have now updated MQ Client Software from version 5.1 to version 5.3, and now my software problem concerning MQPUT has disappeared.

After the update a new problem has occured, because MQGET does not work. But that is a completely different story, that I will look into soon. Here MQGET returns some errorcodes, so it should be possible to solve that.

To me it looks like version 5.1 has some kind of bug or compability problem when connecting to a version 5.3 server version. Anyone else experienced this problem.

The server version is currently 5.3. Our customer says that within a half year they will upgrade to 6.0. Does anybody know if this will give us any problems, if we continue to run version 5.3 as client ?

If we must update to a version 6.0 client will that give any problems, like update from 5.1 to 5.3 did ?
Back to top
View user's profile Send private message MSN Messenger
jefflowrey
PostPosted: Sun May 21, 2006 2:56 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It's better to keep client and server at the same version, to avoid already solved problems and to take advantage of new features and new performance gains.

That said, a server at level X should be compatible with a client at level Y < X, and you should be able to open PMRs for problems caused by the SERVER being unable to work with the client. But that doesn't mean that bugs in the client that are fixed in version X are PMRable - just upgrade the client.

There are also differences in the MQ Java API and the JMS APIs in version 6 that are not necessarily different between v5.2 and v5.3. Among other things, the JMS version changed.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Problem putting data into remote queue
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.