MSMQ, distributed topology, pubsub - queue config question - msmq

I am trying to set up a pub sub using msmq and rhino.esb. I have the publisher on one server and the subscriber on the other. When running locally with everything set to localhost it works fine.
My question is this - if this is my configuration for a local publisher:
<facility id="rhino.esb">
<bus threadCount="1" numberOfRetries="5" endpoint="msmq://localhost/SonaTribe.Services.Schedule.Host" />
<messages>
<add name="SonaTribe.Esb.Messages" endpoint="msmq://localhost/SonaTribe.Esb" />
</messages>
</facility>
Where the bus and messages queues are both localhost.
When they are on seperate machines i have the following config:
<facilities>
<facility id="rhino.esb">
<bus threadCount="1" numberOfRetries="5" name="schedule_host" endpoint="msmq://localhost/SonaTribe.Services.Schedule.Host" />
<messages>
<add name="SonaTribe.Esb.Messages" endpoint="msmq://10.0.0.164/SonaTribe.Esb" />
</messages>
</facility>
</facilities>
Where one queue is localhost and the other is on the remote machine. Is this correct?
All of the samples i can find are all setup to run on the same machine - which is a bit silly as the whole point of this is to be able to distribute the services no?
w://

I'm no expert on ESB but the MSMQ bit looks like you are using pathnames. These need to resolve to a machine in Active Directory. An IP address won't work in doing this as AD knows nothing about IP addresses.
To use an IP address, MSMQ would need to use DIRECT FormatName addressing, such as:
endpoint address="msmq.formatname:DIRECT=TCP:10.0.0.164/SonaTribe.Esb"
or
endpoint address="msmq.formatname:DIRECT=TCP:10.0.0.164/private$/SonaTribe.Esb"
Cheers
John Breakwell

Related

How to load balance several phoenix query servers behind Knox gateway?

I have 3 phoenix query servers running behind a knox gateway (hiding kerberos auth complexity), accessed through Simba's odbc driver. I manage to reach one phoenix query server and launch queries through knox, by directly mapping, in topology file, avatica service to the internal ip address and port of one phoenix query server in my internal network.
I would like to have knox randomly access either of my 3 phoenix query servers, not just one. Do you know if i can achieve this with zookeeper and how i can configure it to do this ?
I've already tried to make some loadbalancing bu making knox topology pointing on an nginx reverse proxy, setting as upstream my 3 PQS but i'm having a 401 error, likewise my credentials were transmitted trough the proxy
my odbc.ini file :
[phoenixovh]
Driver=/opt/hortonworks/phoenixodbc/lib/64/libphoenixodbc_sb64.so
Host=knox.<clusterid>.datalake.ovh
Port=443
AuthMech=2
UID=<user>
PWD=<password>
LogLevel=0
ConnectionSyncInterval=120
SSL=1
HttpPath=gateway/default/avatica
TransportMode=http
part of my knox topology file (working for 1 PQS) (default.xml)
<service>
<role>AVATICA</role>
<url> internal_address__and_port_of_url_of_one_pqs</url>
</service>
I finally managed to have my 3 PQS reached by following know ha guide (https://cwiki.apache.org/confluence/display/KNOX/Dynamic+HA+Provider+Configuration), adding in my topology file an ha provider section and providing 3 urls in the service configuration instead of one:
<provider>
<role>ha</role>
<name>HaProvider</name>
<enabled>true</enabled>
<param>
<name>AVATICA</name>
<value>maxFailoverAttempts=3;failoverSleep=1000;maxRetryAttempts=300;retrySleep=1000;enabled=true</value>
</param>
</provider>
</gateway>
...
<service>
<role>AVATICA</role>
<url>internal url of PQS1</url>
<url>internal url of PQS2</url>
<url>internal url of PQS3</url>
</service>
Knox guide mentions this way and also the zookeeper's connection string but does not provide any insights on which solution is better.

Allow access to wildfly port 8080 over WAN for web page

My team needs to see a web page I have built that I am hosting temporarily on my local windows 10 laptop using Wildfly 11.
I have changed the configuration standalone.xml from commented value to this
<interface name="public">
<!-- <inet-address value="${jboss.bind.address:127.0.0.1}"/>-->
<inet-address value="${jboss.bind.address:xx.xx.xxx.xxx}"/>
</interface>
Where xxx is equal to my ip address as determined from my internet provider's control page. I can ping that address from any of my local machines and my co-workers can also ping the address.
However, when I go to run with this value in the xml, I get the error:
Failed to start service org.wildfly.network.interface.public: org.jboss.msc.service.StartException in service org.wildfly.network.interface.public: WFLYSRV0082: failed to resolve interface public
What else do I need to do to enable access to the port? Thank you in advance for your help.
If your "xx.xx.xxx.xxx" is not the IP number of an interface on your machine, then you won't be able to bind to it. You can only bind to an interface that is actually present on the host. Typically the IP number of your machine, as seen from the public Internet, will not be the same as an IP number on the machine itself. You need to bind your HTTP server to the machine's real IP number (not localhost, 127.0.0.1, but the IP corresponding to some real network connection -- Ethernet, Wifi, whatever) and you need to configure your Internet router to forward packets addressed to port 8080 to the IP number of your wildfly host.
I would think that, if your co-workers are on the same site as you, they would have access to your machine without going through the public Internet. In that case, all you need to do is to bind the port to the (non-localhost) IP number of your machine, and have your colleagues use that IP number. You might also need to configure any firewall you have -- either on your wildfly host or your router -- to allow access to port 8080.
I would recommend that you run Wildfly on the command line with something like:
bin\standalone.bat -b 0.0.0.0
This will have Wildfly bind to all available interfaces. For testing this should be safe - it should be ok to bind to more than on interface. You will not need any changes in standalone.xml.

MailHog or MailCatcher Server setting

I have to automate sending mail and check whether they have been delivered as expected. Inorder to do that i am using mailHog(similar to mailCatcher). I have installed them but i don't know how to make my application send mail to this service instead of normal email sending.
They say that you have to configure your SMTP port to 1025 instead of 25(default). Even after this i am not able to capture those sent mails. Do i need to change my outgoing server name or what else should i do??
This is my web.config file code:
<add key="SmtpServerPort" value="1025" />
<add key="SmtpEmailServer" value="BLRCSWEXV01.in.corp.xxxx.com" />
PS: I am using protractor to write E2E tests. And i dont want to use mailListener, because it slows my test drastically and even it is not able to capture the mails
Have you installed MailHog on BLRCSWEXV01.in.corp.xxxx.com or is it on an other machine? You need to point both, the server and the port to your MailHog instance.

Rebus and Remote queues

I'm using Rebus (https://github.com/rebus-org (v.0.83)) and until now it's been all local to a single machine. Now I need to use a remote queue from my website to an app server. It's not abundantly clear to me how to set this up with Rebus. A few questions
I guess I need MSMQ on both machines (web & app) correct? I've configured the web site to UseMsmqInOneWayClientMode;
or is there a way to specify to send it over http?
My configuration looks like this more or less. I'm guessing that inputQUeue needs to point to the local machine not the remote one right?
<rebus inputQueue="mywebqueue" errorQueue="MyErrorQueue#mymachine" workers="1" maxRetries="5">
<endpoints>
<add messages="MyLibrary.CreateMessage, MyLibrary" endpoint="MyQueue#mymachine"/>
</endpoints>
</rebus>
Help would really be appreciated.
Yes. All machines that need to use MSMQ somehow, need to have MSMQ installed. Even as a one-way client, like your webserver, because MSMQ achieves its high availability by providing outgoing queues when you send to remote machines.
I think so. I've never used MSMQ beyond its basic reliable messaging capabilities. Google around, I bet you can find something ;)
Your configuration looks right. And yes - input queues are always local, whereas queues you send to (error queue and all endpoints specified in the endpoint mappings) can be remote too.

Genymotion view localhost site

I am building a website, and I would like to see how it is rendered on an Android Smartphone, so I downloaded Genymotion. I can't see any pages on my local site from Genymotion ("Bad request - invalid hostname").
When I launch the Visual Studio solution, the homepage address is
http://localhost:18207
so following the advice that I found for example here I typed in Genymotion the following addresses:
http://10.0.3.2:18207
http://192.168.56.1:18207
http://(my ip address):18207
but I always have the above mentioned error, or sometimes a timeout error.
Thanks a lot for any suggestion!
I ran into this exact same issue and resovled it with the help of this blog post:
http://blog.binarybits.net/applications/iis-express-http-error-400-the-request-hostname-is-invalid/
I don't want to take any credit for the content of that post, but just in case it goes offline I'll lay out the process. Essentially you need to update the configuration for IIS Express so it'll accept the incoming request from Genymotion. So assuming that your site is running on port 8080:
Step 1 - Modify the specific configuration for your site in C:\Users\\Documents\IISExpress\config\applicationhost.config so it's tied to * instead of localhost
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="PATH TO YOUR SITE" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:*" /> <!-- CHANGE THIS LINE -->
</bindings>
</site>
Step 2 - Add an ACL rule to let incoming connections access your laptop on this (run this command via admin)
netsh http add urlacl url=http://*:8080/ user=everyone
Step 3 - Finally connect to your site within Genymotion using this special address
http://10.0.3.2:8080/
That worked for me, so hopefully it works for you as well.
In my case, a slight modification in the answer provided by Sam Storie solved the problem.
My local service is hosted using MVC Web Api controllers (I'm using Visual Studio 2013).
In step 1, instead of replacing :8080:localhost to :8080:*, I just added a new binding right next to the existing one. The new binding does not have either localhost or * in it. It will look like this:
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" /> <!-- Existing binding -->
<binding protocol="http" bindingInformation=":8080:" /> <!-- New binding. Note that there is no asterisk(*)-->
</bindings>
Just in case it is not clear, ensure that you replace 8080 with the actual port where the service is hosted on localhost. In my case it is 53533.
Run your web server on the 192.168.56.1 net. This is usually a setting in the server config. It's probably defaulting to the real adapter of your host, not the virtual adapter that VirtualBox is connected to. I'm not sure what host OS you're on, but the virtual adapter is usually vbox0 for a Linux install. This is the virtual network that Genymotion is on.
Your Genymotion VM will have a DHCP address like 192.168.56.101. You can check for sure with the Genymotion config app inside the VM. If this is the case, and your web server is also on this subnet, you should be able to point your Genymotion browser to 192.168.56.1.
You just need to use http://yourHostIpAdress/YourWebSite (no need of port)
At least this worked when publishing the website locally through IIS