Strophe & Ejabberd: problem with reauthentication after sending message - xmpp

Im using Strophe attach method to connect to ejabberd (2.1.6) with external authentication. Everything works fine after attaching, but when I'm trying to send a message stanza to some user, that user does not recieve his message. Message stanza is stored in spool table in database. I don't know why the message isnt delivered directly to the user.
The only thing I see in ejabberd log is that after sending message ejabberd is testing user to whom I sent the message with external isuser call, and after that ejabberd reauthenticates me.
I don't know if that reauthentication is normal thing or there's something out there that I do wrong.
Do any of you had this type of problem before? If so, how did you managed to solve it?

Is it the sender that is getting reauthenticated? If so, it's possible that you're sending XML that is not well-formed, and the server is disconnecting you.

It appears that there was a problem with my app and htaccess file which sent all requests to index.php if the resource was not a directory or a file, which caused my app to once again run GET request if there was an image that did not exist on server, but was included in html.
And because I was connecting to ejabberd on every request (except for ajax) reauthentication was taking place.
Than you for your interest.

Related

How to get message by message_token using Viber REST API?

I'm building the Viber bot which will be served using different services. One of the problem is about getting the exact message which has been sent to the user.
The "received" event gives message_token, so I wonder if it's possible to use it in order to get the message.
Or I have to use my own mechanism of sync?
Viber message_token is an identifier for peer-2-peer connection between Viber server and/or your local or online server and not the actual message. Moreover, there is no "buffer" for messages to be stored both locally or online. There is an internal process to store message when recipient is offline and then resend message when it is got online but I couldn't find direct access to them.
I did something similar by storing incoming messages to SQL using datetime (milliseconds) as timestamp in order to identify the message. However, you can combine Token also for knowing the session or to be more specific user_ID, both are unique.
Hope that helps to work around your problem...

IBM Sterling order management - Email Server

I'm trying to send the mail to the store (Node), on the onsucess event of createOrder api.
So for this, I've created 2 new services.
The first service receives the information from the onsucess event of the createOrder api and passes it on to the queue.
The second service receives the information from that queue and passes it on to the email server.
This sends the email. The problem is that for some of the orders the email is not sending, but we are not getting any exceptions for these.
In the logs for those orders it shows the "Successful Acknowledgement from the email server".
I don't know where the exact problem is. I have checked the email server, but cannot find anything related to the missing order information.
What steps can I take to further debug this problem?
You are saying, only some orders have this problem . Then it will be something related with the order details like the email id associated with it. And also if the successful message in logs shows message has been sent. But if it is a customized log please check it once again. If its Ok then please check the Email Server logs directly.

Multiple emails with ZF2 & Amazon SES

I'm sending emails using Zend Framework 2's SMTP transport, and through Amazon's Simple Email Service. Everything works great until I need to send more than one email in the same request - then I get this weird exception.
Fatal error: uncaught Exception
'Zend\Mail\Protocol\Exception\RuntimeException'
with message
'Could not read from email-stmp.us-west-2.amazonaws.com'
in
/www/vendor/zendframework/zendframework/library/Zend/Mail/Protocol/AbstractProtocol.php
on line 308
I've tried doing an rset() on the connection, and it just produces the same error. Right now I've resorted to manually calling disconnect() after every send() - which makes ZF2 reconnect the next time and it works - but obviously not ideal.
I'm using ServiceLocator & Factories, therefore all this is happening on the one single connection (as it should).
Has anyone experienced anything like this? Any ideas?
Thanks
It is the same email or different content? If same you can just put another addTo or addBcc inside same request.
Also try to check with amazon how many mails you can send at once, I know they have a limit on mail sending. (I used amazon for shared webhosting and I need to request permission to send more emails at once).

Using FIX protocol to connect to the broker

I am currently trying to build a program using FIX protocol to communicate with a broker (currenex). I sent my (self-generated) logon message to the server and got something back.
This is what I sent
8=FIX.4.49=8835=A49=xxxxxxxx56=CNX34=152=20140718-11:40:18.24498=0108=30141=Y554=xxxxxx10=128
(the SenderCompID and the password were replaced)
and I got
8=FIX.4.49=7635=A34=149=CNX52=20140718-11:40:33.22456=xxxxxxxx141=Y98=0108=3010=1458=FIX.4.49=7035=h34=249=CNX52=20140718-11:40:33.22656=xxxxxxxx336=0340=210=128
back from the server.
I think I built the logon message correct (or did I?). But when I sent a second request MarketDataRequest
8=FIX.4.49=13735=V49=xxxxxxxx56=CNX34=252=20140718-11:42:53.504262=363263=1264=0265=1266=N267=2269=1269=0146=155=GBP/USD554=xxxx10=013
I had no response at all. I asked the broker and they said the connection dropped right away every time after I logged in.
I thought it was some connection problem and I tried using RESTClient (Postman) to send the message but the result was the same.
Could any one take a look at my messages and point out if there is something stupid please?
All I need is the real-time exchange rate so a simple FIX message example will be very helpful. Thanks a lot!
Regards,
Bo
Your logon response message says that your trading session is open (340=2) so it's not broker-side problem. I think your program disconnects TCP/IP connection from server after login message. FIX protocol insists that TCP/IP connection must be kept alive during the whole FIX session - otherwise the session will be closed. So you need rewrite your program to keep connection alive and just send there yor requests and listen for responses. Don't close the connection.
Try using Minifix tool which will maintain the heartbeats and the session connection.
Ideally for a 35=V request you should get
35=W = Market Data-Snapshot/Full Refresh
35=X = Market Data-Incremental Refresh
35=Y = Market Data Request Reject
you get a 35=3 (reject) or 35=4 (or a seq reset) in response to a 35=A request.

ColdFusion email - is there a way to confirm the email has been sent?

Just using the standard cfmail tag, is there a way we can confirm that the email has been sent?
I tried cftry/cfcatch but that only confirms that there were no errors in processing the tag, if I put in an invalid mail server, it passes (but mail obviously doesnt send)
One hackish way, if do not have access to the logs, is to bcc an alternate address.
If it is not in the spool folder, and not in the error log, it has been sent.
see: Using ColdFusion with mail servers
You can always write a routine to check the mail log. That requires you to have access to the log files.
If you turn off spooling the messages to disk, they'll attempt to be sent immediately. Then you can trap with try/catch which should let you log any SMTP errors. If you don't get an error then you are reasonably assured that the message was sent successfully.
This may have negative ramifications for performance under load. It will also negatively impact the user experience as the user will be waiting for the SMTP negotiation that usually takes place in the background. You might then consider using CFTHREAD, but then why not just use the native spooling?