MessageEnumerator.MoveNext() error from remote server - C# - msmq

I have created one console app where i implemented search message from MSMQ functionality for specific criteria (Label/ Body / Priority).
MessageQueue msgQ = new MessageQueue("FormatName:Direct=OS:(MachineName A)\private$\TestQueue")
msgQ.Label = "Label test" // Simlarly i set search criteria
MessageEnumerator msgEnumtr = msgQ.GetMessageEnumerator2(); // Search Queue
While(msgEnumtr.MoveNext(timeout)) // This line works fine in MSMQ server, not working remote server.
{
Message currentMsg= msgEnumtr.Current;
}
Here "TestQueue" is the private queue set up in "Machine A". I have given Anonymous Login rights for this queue.
I am running my console application from "Machine B" connected in the same LAN. MSMQ components also enabled/installed on this machine. When i run my console exe here, getting "Object reference not set to an instance" error at "While(msgEnumtr.MoveNext(timeout))" line. Sometime i am getting following error "cursor is not currently pointing to Message instance".
But when i run this exe from "Machine A", its working fine & searching as expected.
(Note : queue.Send(Msg) - (Put message to queue) Works fine in both machine, only issue with search functionality)
Anybody can help me out on this. Thanks.

Related

Spring Integration: Imap, continuous remote service polling caused by attribute mail-filter-expression in imap-idle-channel-adapter

I implemented a imap idle mail receiver with spring integration mail 4.2.6.
When, in the configuration of the receiver in the tag
<mail:imap-idle-channel-adapter mail-filter-expression="something" ... >
i use the attribute "mail-filter-expression" this causes continuous ( about every second) polling of the remote mail service with this repeated message:
10:29:21 INFO o.s.i.mail.ImapMailReceiver - attempting to receive mail from folder [INBOX]
If i remove the attribute "mail-filter-expression" this continuos polling disappears.
I don't know if this is the desired behavior of the framework.
My idea is to limit this comtinuos polling of the remote service, in fact i'm using the imap-idle-channel-adapter
this is my configuration of the receiver:
<mail:imap-idle-channel-adapter
id="mailAdapterMailInAccettazione"
store-uri="imaps://...the url of the remote service
channel="emailsInAccettazioneDaLeggere"
auto-startup="true"
should-delete-messages="false"
should-mark-messages-as-read="false"
java-mail-properties="javaMailProperties"
mail-filter-expression="subject matches '(?i).*somenthing: .*'" >
<mail:transactional synchronization-factory="syncFactoryAccettazione"/>
</mail:imap-idle-channel-adapter>
I want to cofigure the receiver in idle mode but using the mail-filter-expression attribute because i want to read only some emails.
UPDATE : after further investigation i discovered that the remote mail service doesn't support RECENT and USER flag:
This email server does not support RECENT or USER flags
So this is what was happening:
mail-filter-expression caused messages to get filtered, but no message was flagged as RECENT = false. This caused
continuous attempts to read the messages as all messages always appeared "
new"
.
I re implemented the flow not using the mail-filter-expression but filtering messages in subsequent channels

EventLog Production

I have a console application that is responsible for saving a record in the Windows Event Viewer, but it does not work on a clean machine, despite having already installed the .Net Framework.
Create an installer which is responsible for creating the route HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\MyLogEvent
When running the installed application, it does the whole process without throwing any errors, but it is not saving anything in the Event Viewer.
A strongname has already been added.
string origen = "ErrorGeneric";
EventLogEntryType severidad = EventLogEntryType.Error
if (!EventLog.SourceExists(origen))
{
EventLog.CreateEventSource(origen, "MyLogEvent");
while (!EventLog.SourceExists(origen))
{
Console.Write(".");
Thread.Sleep(1000);
}
}
EventLog log = new EventLog() { Source = origen };
log.WriteEntry(logString.ToString(), severidad);
I found the error, I needed to add the source to the installation, so that it was created in the windows registry

check Q Apply control table IBMQREP_RECVQUEUES

I am using Q Apply application to receive messages from an MQ Server and I am getting the following error message:
ASN0576E "Q Apply" : "ASNQ" : "BR00000" : The program cannot access the WebSphere MQ queue " ASN.COLDBBLD.ADMINQ". The queue name was specified in column "ADMINQ" of control table "IBMQREP_RECVQUEUES"
This ASN0576E code is when a queue doesn't exist or then the queue name is incorrect in the control tables. I already check the MQ side and everything is fine, the queue does exist, etc.. So the problem is on the DB2 side
I know I have to check in the IBMQREP_RECVQUEUES control table but I am not sure which command I should use. Is it asnqacmd, or asnqapp, etc..
Thanks in advance

How to get a log out of run command in a remote node that is triggered by NodeExecutorResult

I am making a Rundeck plugin in where it uses a node executor to trigger
a another module in remote. Then I want to verify whether or not this remote command is finished successfully so that I need the log message of the command in remote that the node executor triggered.
NodeExecutorResult ner = jne.executeCommand(context.getExecutionContext(), command, ine);
But the NodeExecutorResult above doesn't have any log data but only have a result code and a result data and failure message and code. How can I get the log? I am sure that the api exists. Because I can see the log output in the console of rundeck. Thanks for reading.
The NodeExecutorResult interface has other methods inherited from other interfaces, try the following :
NodeExecutorResult ner = jne.executeCommand(context.getExecutionContext(), command, ine);
String failure message = ner.getFailureMessage();
FailureReason freas = ner.getFailureReason();
Map<java.lang.String,java.lang.Object> fdata = ner.getFailureData() ;
For the FailureReason it rather can be a NodeStepFailureReason or StepFailureReason.
Check their API and the implementations enums :
FailureReason
NodeExecutorResult

Debugging a crashing language server

I apologize if I'm a bit low on details here, but the main issue is actually trying to find the problem with my code. I'm updating an older extension of my own that was based on the Language Server example (https://code.visualstudio.com/docs/extensions/example-language-server). I've run into an issue where when I run the client part of my code using F5, and the debug window fires, I get:
The CSSLint Language Client server crashed 5 times in the last 3 minutes. The server will not be restarted.
Ok... so... here's the thing. The problems view in my extension client code shows nothing. DevTools for that Code window shows nothing.
The problems view for my server code shows nothing. DevTools, ditto.
For the Extension Developer Host instance, DevTools does show this:
messageService.ts:126 The CSSLint Language Client server crashed 5 times in the last 3 minutes. The server will not be restarted.e.doShow # messageService.ts:126
But I can't dig into the details to find a bug. So the question is - assuming that my server code is failing, where exactly would the errors be available?
Here is what I usually do to track server crashes down (I assume your server is written in JavaScript / TypeScript).
Use the following server options:
let serverModule = "path to your server"
let debugOptions = { execArgv: ["--nolazy", "--debug=6009"] };
let serverOptions = {
run: { module: serverModule, transport: TransportKind.ipc },
debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions}
};
Key here is to use the TransportKind.ipc. Errors that happen in the server and printed to stdio will then show in the output channel associated to your server (the name of the output channel is the name passed to the LanguageClient)
If you want to debug the server startup / initialize sequence you can change the debugOptions to:
let debugOptions = { execArgv: ["--nolazy", "--debug-brk=6009"] };
If the extension is started in debug mode (e.g. for example launched from VS Code using F5) then the LanguageClient automatically starts the server in debug mode. If the extension is started normally (for example as a real extension in VS Code) then the server is started normally as well.
To make this all work you need a latest version of the LSP node npm module both for server can client (e.g. 2.6.x)