Unable to get message from queue in IBM websphere MQ - asp.net

I am connecting remotely to MQ on the server and i installed MQ client v6.0 on my machine.
I am able to put the message into the queue but i am unable to get the message from the same queue the output is "RC2033: MQRC_NO_MSG_AVAILABLE"
Can anyone please help me to find the issue?
Will this be due to properties of the queue?
The following is the code which i am using to pop the message :
Pop Message:
queue = mqQMgr.AccessQueue("queue_name", MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_INPUT_SHARED);
MQMessage queueMessage = new MQMessage();
queueMessage.Format = MQC.MQFMT_STRING;
MQGetMessageOptions queueGetMessageOptions = new MQGetMessageOptions();
queueGetMessageOptions.Options = MQC.MQGMO_WAIT;
queueGetMessageOptions.MatchOptions = MQC.MQMO_NONE;
queueGetMessageOptions.WaitInterval = 1000;
queue.Get(queueMessage, queueGetMessageOptions);
tbPoptxt.Text = "Message No" + count + ":" + queueMessage.ReadString(queueMessage.MessageLength);
PUSH CODE
int optons = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING;//Queue which opens with options output
queue = mqQMgr.AccessQueue("queue_name", optons);
MQMessage queueMessage = new MQMessage();
queueMessage.WriteString(tbPushtxt.Text.ToString());
queueMessage.Format = MQC.MQFMT_STRING;
MQPutMessageOptions queuePutMessageOptions = new MQPutMessageOptions();
queuePutMessageOptions.Options = MQC.MQGMO_SYNCPOINT | MQC.MQGMO_FAIL_IF_QUIESCING;
queue.Put(queueMessage, queuePutMessageOptions);
mqQMgr.Commit();
I am using same queue for putting a message and poping a message

Look in the samples directory for the nmqsput and nmqsget c# examples - these do exactly what you are after and are good working examples.
Looking at the code above, I do not think there is a problem getting the message, followed up by your comment that amqsputc failed to find a message as well. I think the problem is on the putting side.
This may sound a silly question, but how do you know the message is there. What is the curdepth after the put? Look at the queue status - are there any uncommitted messages? (One thing I've seen before is putting under a unit of work (syncpoint) and then not committing and then another application trying to get it.

Related

Push sharp: Sending same message again and again

I am new to Push Sharp.
I am trying to send messages to Android devices using Push Sharp. It works great but the problem is that Push Sharp is sending same message again and again.
My Code is:
AndroidPushBroker = new PushBroker();
var googleKey = CustomConfigurationManager.GetValueFromSection("appSettings", "GoogleServerAccessKey");
AndroidPushBroker.RegisterGcmService(new PushSharp.Android.GcmPushChannelSettings(googleKey));
var jsonMessage = "{\"InformationId\":\"" + notification.Message + "\",\"badge\":7,\"sound\":\"sound.caf\",\"NotificationType\":\"" + notification.Type.ToString() + "\"}";
GcmNotification androidNotifcation = new GcmNotification().ForDeviceRegistrationId(notification.DeviceId)
.WithJson(jsonMessage);
AndroidPushBroker.QueueNotification(androidNotifcation);
Issue: When i send message "Message 1" and then later on send "Message 2", it sends "Message 1" again. Do I need to remove items from Queue ? Or what am I missing. ?
Note: I have single instance of Push Broker in my application.
I'm not very experienced with PushSharp either, but my guess is that you are not emptying the notification queue after sending your message.
Try to add the following after your QueueNotification call
AndroidPushBroker.StopAllServices();
Finally I got the issue.
I was registering my gcm service again and again which was causing duplicate events.
AndroidPushBroker.RegisterGcmService(new PushSharp.Android.GcmPushChannelSettings(googleKey));
This should be called only once.

libgit2sharp.Patch outofmemory

I try to use libgit2sharp.Patch to find how much line added or deleted, but i got an error while i try to run it. When i run my asp.net mvc project in debug mode, it doesn't have any problem, until i run it without debug mode, i got my web load too long and didn't show the page. When i run in debug mode again, finally an error appear from libgit2sharp.Patch variable with error message system.outofmemory. This is how i implement libgit2sharp.Patch
Patch treePatchInfo = repo.Diff.Compare<Patch>(firstTree, compareTree, null, compareOptions: compareOptions);
commitChangeValue = from s in treeChangeInfo
let patch = treePatchInfo[s.Path]
select new CommitChangeModel
{
ChangeKind = s.Status,
LinesAdded = patch.LinesAdded,
LinesDeleted = patch.LinesDeleted,
OldPath = s.Path,
Patch = patch.Patch,
Path = s.Path
};
If you're only interested in number of additions/removal per file, I'd suggest you to rather rely on the following construct would be more efficient.
var stats = repo.Diff.Compare<PatchStats>(...);
You can take a peek at PR #660 where it's been introduced to get a first grasp of its usage.
Note: Regarding the OOM Exception, we'd very interested in getting more information about it. Would you be so kind as to open an issue in the bug tracker so that we can get a deeper look at it?

Unity Network.Connect() returns no error

I'm trying to create an online game, It works in my computer, and even in two different computers in my house. But it does not connect to room of other players.
I'm testing by trying to connect a closed room, naturally it does not connect, but still the NetworkConnectionError returns "NoError" , and the OnFailedToConnect() function is never called.
My code is this:
if(GUI.Button(Rect,"Connect"))
{
var error = Network.Connect(element);
printConsoleEntry("Connection attempt : " + error);
}
which prints "Connection attempt : NoError".
But at some point, I see in the "real console", in the unity editor window,
The connection request to
192.168.x.x:26500 failed. Are you sure the server can be connected to?
But it does not show immediately I press the "connect" button. It waits a little. And it only shows once, out of a 100 presses, So is there some kind of yielding?
I also tried to yield the error in a coroutine like :
var error = Network.Connect(element);
yield error;
printConsoleEntry("Bağlantı denemesi : "+error);
it always returns NoError.
so where is the error?
How can I see it?

Blackberry getting notified when the internet connection is available.

is there any way to know whether the net is connected or not in a blackbery device .I have the following code but it was waiting till the network timed out.
int rc = connection.getResponseCode();
if (rc != HttpConnection.HTTP_OK) {
throw new IOException("HTTP response code: " + rc);
}
Is there any other way.
The title of this question has a different meaning than the body of the question. Based on the title, you can be notified when the network starts by using the RadioStatusListener interface, which defines a networkStarted() function. You could then use the checks that coldice recommends to make sure that the current network supports data transfer.
RadioStatusListner JavaDocs
There are several API for getting network info:
RadioInfo.isDataServiceOperational();
CoverageInfo.isOutOfCoverage();
WLANInfo.getWLANState();

Blackberry JDE HTTPConnection problems

So, I'm using the HTTPConnection Class, like so:
HttpConnection c =
(HttpConnection)Connector.open("http://147.117.66.165:8000/eggs.3gp");
Following what LOOKS like the right way to do things in the Blackberry JDE API.
However, my code crashes if I try to do just about anything with the variable 'c'.
.getType()
.getInputStream()
.getStatus()
all cause it to crash.
I can, however get the URL from it, and I can look at the variable 'c' itself to know that it did, in fact, get created.
Did I manage to create a broken Connection? Do I need to do something else to actually do things with the connection? Under what circumanstances will this happen (I know the link is good, I can use the blackberry's browser to visit it).
Am I just using HttpConnection wrong? How would I do things correctly?
What error is it throwing when it crashes? You may want to try adding the "Connector.READ_WRITE" as a second argument to your open call - even if it's just a "read only" connection like a GET, some OSes such as 4.6 will throw an exception unless you open it in read/write mode.
I figured out what was wrong by finding some sample code that was using HttpConnection, (at least, I think I did, at least, I can access all those variables, now). Before, I wasn't ever casting it as a "Stream Connection" (the examples I saw had it cast from Connector to HTTPConnection).
StreamConnection s = null;
s = (StreamConnection)Connector.open("http://10.252.9.15/eggs.3gp");
HttpConnection c = (HttpConnection)s;
InputStream i = c.openInputStream();
System.out.println("~~~~~I have a connection?~~~~~~" + c);
System.out.println("~~~~~I have a URL?~~~~" + c.getURL());
System.out.println("~~~~~I have a type?~~~~" + c.getType());
System.out.println("~~~~~I have a status?~~~~~~" + c.getResponseCode());
System.out.println("~~~~~I have a stream?~~~~~~" + i);
player = Manager.createPlayer(i, c.getType());
Even though the stream is now successfully being created, I'm still having problems USING it, but that might be because my connection is so slow.
The API documentation for HttpConnection suggests the first call should be to c.getResponseCode(), try that.
You should find everything you need in my blog post "An HttpRequest and HttpResponse library for BB OS5+"
And for invoking media within your application you can do either a browser invokation or directly from app. You would probably be best to use the browser like so:
BrowserSession invokeHighQuality = Browser.getDefaultSession();
invokeHighQuality.displayPage("URL goes here");
OR you can try this:
// CHAPI invocation
Invocation invoke = new Invocation(_data.getUrl(), null, BlackBerryContentHandler.ID_MEDIA_CONTENT_HANDLER, false,
null);
try {
Registry.getRegistry(YourAppClass.class.getName()).invoke(invoke);
} catch (Throwable t) {
}

Resources