Just setup a UDP appender, and its not working, how can I very quickly check if messages are being sent outbound from the app?
Have you tried monitoring them with a tool?
Log4net Viewer: With this tool you can recieve de udp-messages
WireShark: With this tool you can watch all the trafic on your network card and see if the messages are being send
Really fast way for me was was SocketSniff.
Send one message at the start of the application at a level that will be logged. This way, you can be sure that it works at a specific point in time.
You also can use Log2Console !
Related
An Azure Service Bus/Queue question...
We have systems (SystemA) that have 'no' internet connection direclty, but can connect to another server (SystemB) via whatever ports we decide to open.
SystemB can connect to internet and Azure no problem.
But I can't see how to use SendVia so that I can say
SystemA, Send a Queue message Via SystemB.
(https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-transactions)
What would we install on SystemB... or is Send Via just for, well, I don't know what it's for if not this...
Would we have to roll our own solution for SystemA->SystemB part? Or am I missing somthing?
Thanks for any assistance.
Send-via is not what you think it is. It only can operate on the same namespace and connection.
or is Send Via just for, well, I don't know what it's for if not this...
The feature is intended for transactional processing of the incoming message with the dispatch of the outgoing messages.
We are developing application for chatting.But when I am sending messages and if internet connectivity is gone how will I be able to send the messages like what's app do?
You have to use a message broker software like RabbitMQ (https://www.rabbitmq.com) to handle these kind of situations.
Off course, you can't really send messages offline, so what applications do is:
buffering/storing "sent" messages if there is no network available
check/await for network connection to be reestablished
Actually send messages when application reconnects
For achieving this, if you're looking mainly on chat, you can use some library/package/software (as for example RabbitMQ mentioned on #Badis Merabet answer).
If there is no prebuilt solution available for your use case or you want to develop you own solution, you may use PWAs. Here are some links:
General information on PWAs
Angular PWA docs
You may also check this answer for more information. The last link have a cookbook on an approach to implement it.
I'm sending log messages with log4j 2 socket appender to a log server. If the remote server shuts down messages get lost. I want to retransmit them when the connection re establishes.
I could probably do it by catching the socket exception and saving the message to a temporary queue. Can it be done using only log4j configuration? Maybe using a failover appender or some such?
Edit:
Any ideas? Maybe with async appender. It already has a queue.
That's quite difficult. Because it should be some kind of reliable protocol. E.g. the fact that something was sent by socket doesn't mean it was received and written to a disk/etc. Have a look at JMSAppender for example.
For a simple fail-over you could just use two appenders and two remote servers, just don't reboot them both at the same time.
However, a logger is not something you should care too much about reliability. If you have a business requirement for it, you should implement it somehow differently using appropriate tools.
Is there an ipc option to get the last message in message queue but not removing it?
I want this to allow many clients reading same messages from the same server..
Edit:
Server and clients are on the same machine!
Thanks
I don't believe there is any way to do that using either system v or POSIX message queues. Furthermore, AFAIK neither API allows you to send messages to a remote machine, so unless your clients are running on the same host as the server, you will need to use a higher-level technology.
Is there a way to peek or see a message before it hits the SMTP on IIS. This is not an Exchange Server, it's just running SMTP. I am trying to see if I can look at the message and then pass it to SMTP?
Thanks
Edit ~ Instead of adding another listner, I am wondering if there is a way to bind to the default SMTP listner and intercept the message then pass it on.
2nd Edit~ Ok, here is my problem. I have a spam filter in front of my exchange box, unfortunately (due to software design) the filter is limited when it comes to "Directory Harvesting Loookup". This is the process where the email addresses are checked if they exists in AD and the mail is dropped if they don't. My current filter drops the mail if one of the addresses does not exists in AD which is not good. I spoke with the vendor and there is nothing they can do at this time. I am looking put an app in front of this filter which would intercept (open, read, parse) the mail, validate the addresses, and then pass on the email to the filter for additional scanning. I'll then trun off this feature in their software. Don't get me wrong, their filter works great with this one exception which I must fix since I have tons of emails send to nonexistent users in my domain.
You can write your own Proxy SMTP service that you connect to to send messages. You can forward all messages directly to your actual SMTP service and pass all responses back. Then you can evesdrop on all these messages and deal with them accordingly.
Might be a bit overkill for what you're after but it's fairly simple to code as you dont need to know anything about the protocol as all you're being is a proxy.
If you're using .NET 2.0 then you can log SMTP sessions to a file:
How do I create a log file of the SMTP session? (System.Net.Mail)
Updated:
Take a look at this question:
Testing SMTP with .net (Stack Overflow)
From your edit:
"I am wondering if there is a way to bind to the default SMTP listener and intercept the message then pass it on?"
...and from your comment below:
"I am looking to inspect the actual message before the SMTP gets it."
I'm not sure if you fully understand the SMTP protocol. SMTP messages aren't just monolithic fire-and-forget entities. SMTP is session based and there is a conversation between client and server, of which, the message is just a part. The tracing method (linked to above) will record the entire exchange between client and server and does intercept the whole message before passing it on. The alternative, a proxy or mock server, will still require your application to engage in the SMTP client/server exchange. The closest solution to your requirement would be to use something like Papercut which is linked to in the answer above.
Kev
In .Net you can tell the SmtpClient to send email to a different folder than the SMTP service is monitoring. That way you could check each message, then move it to the real pickup folder. (See SmtpClient.PickupDirectory)
IIRC, you can still write up event sinks for the IIS SMTP service (even though it's not full blown exchange). It's been many years since I've done this, but you may want to google for "exchange event sink" to see if that helps.
Seems like a something like Ethereal will let you accomplish the sniffing portion of your request. Its not clear to me what you mean by "intercept" and "pass on". Do you want to filter some traffic or just delay traffic long enough for you to inspect before you pass it on, or both?