How to handle connection drops in spring rabbit ? - spring-rabbit

How can I handle the connection dropping from my rabbit server in spring-rabbit ? Are there any specific options I need to set ? Config shown below :
<rabbit:connection-factory id="connectionFactory" host="${rabbitmq.host:rserver1}" port="${rabbitmq.port:5672}"
username="guest" password="guest" />
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />
<rabbit:admin connection-factory="connectionFactory" />
<rabbit:queue name="Q1.${server.name:unknown}" />
<rabbit:queue name="Q2.${server.name:unknown}" />
<rabbit:listener-container connection-factory="connectionFactory">
<rabbit:listener queues="Q2.${server.name:unknown}" ref="q1QueueConsumer" />
<rabbit:listener queues="Q2.${server.name:unknown}" ref="q2QueueConsumer" />
</rabbit:listener-container>
<rabbit:topic-exchange name="Exchange">
<rabbit:bindings>
<rabbit:binding queue="Q1.${server.name:unknown}" pattern="#.Q1.#" />
<rabbit:binding queue="Q2.${server.name:unknown}" pattern="#.Q2.#" />
</rabbit:bindings>
</rabbit:topic-exchange>

Spring rabbit can automatically handle reconnecting to the broker. Just be careful as the 1.0.0 Release doesnt play nice with the 1.8.x releases of RabbitMQ

Related

Silverlight and JavaScript Communication

I'm having a dandy of a time getting Silverlight and JavaScript to communicate with each other.
In the page.xaml.cs file, I marked the class as ScriptableType and two methods with ScriptableMember. I then declared:
HtmlPage.RegisterScriptableObject("Page", this);
When I attempt to invoke either method, I get obj.Content.Page is undefined:
var obj = document.getElementById('silverlightControl');
alert(obj); // [object HtmlObjectElement]
alert(obj.Content); // Content
alert(obj.Content.Page); // obj.Content.Page is undefined
alert(obj.Content.Page.GetRegion());
On the flip side, inside of a method in page.xaml.cs, I am calling:
HtmlPage.Window.Invoke("mapRegionChanged", GetRegion());
I have a respective method in JavaScript, which never gets called:
function mapRegionChanged(region) {
alert("Region changed: " + region);
}
The Silverlight object is declared as follows:
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
width="151px" height="77px" id="silverlightControl">
<param name="onload" value="regionsLoaded" />
<param name="source" value="<%= Url.Content("~/ClientBin/Worldmap.xap") %>" />
<param name="onerror" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="2.0.31005.0" />
<param name="autoUpgrade" value="true" />
<param name="enableHtmlAccess" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" />
</a>
</object>
The UserControl is defined in XAML as:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Worldmap.Page"
Width="151" Height="77" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
<Grid x:Name="LayoutRoot" Background="White" Width="151" Height="77" Cursor="Hand" MouseMove="OnMouseMove" MouseLeftButtonUp="OnMouseUp" MouseLeave="OnMouseLeave">
I experienced this problem. Firefox is my default browser and is therefore the browser that Visual Studio (actually VWD, but no matter) starts up. While developing, I added the JavaScript calling code to the client page and found that the "content" child member of the Silverlight component could not be found in the DOM in FireFox -- but it could be found in IE. I restarted the Visual Studio web servers (the ones in the system tray) and hey, presto -- it worked in Firefox! The problem seems to have been caused by the caching of the Silverlight component in those web servers.
Make sure to enable HTML acces:
in C#:
System.Windows.Interop.SilverlightHost host = Application.Current.Host;
System.Windows.Interop.Settings settings = host.Settings;
bool enableAcces = settings.EnableHTMLAccess;
enableAcces = true;
in HTML:
<param name="enablehtmlaccess" value="true" />
This worked for me.
If you found some incompatibility between FireFox and IE, we'll need to report it. Might be something else in the JS on the page, or it might be a setting in FF3 (like flashblock-type stuff)
Some days ago I have read the php architect magazine and there's an article about Silverlight that explains how to communicate with javascript, you might want to check it out.
Go to http://www.phparch.com and register so you can download the magazine, then you must download the May 2009 issue, all other issues must be paid but this one in my account was free, I hope in yours too, if you can't download it just let me know and I can send you the PDF by email.
And here is the direct link to download it:
https://store-phpa.phparch.com/c/phpa/magazine/pickup/97
Best regards,
Alexandru

How do I hook into IDP initiated single logout to run custom code?

I'm using sustainsys.saml2.httpmodule. I would like to run some code to log the logout from an IDP initiated single log out. The user also does not seem to be logged out (IsAuthenticated is still true) after an IDP initiated single log out even though https://stubidp.sustainsys.com/Logout gives me a success result.
I can't seem to find anyone else needing the same functionality or having the same issues. My Sustainsys config is below.
<sustainsys.saml2 entityId="http://localhost:53758/Saml2"
returnUrl="http://localhost:53758/Common/Pages/Saml2Login.aspx"
authenticateRequestSigningBehavior="IfIdpWantAuthnRequestsSigned"
validateCertificates="false"
publicOrigin ="http://localhost:53758/">
<nameIdPolicy allowCreate="false" format="Unspecified"/>
<metadata cacheDuration="PT1440M" wantAssertionsSigned="true">
<organization name="ab" displayName="ab" url="https://www.example.com/" language="en" />
<contactPerson type="Technical" email="a#b.com" />
<requestedAttributes>
<add friendlyName ="Some Name" name="urn:someName" nameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true" />
</requestedAttributes>
</metadata>
<identityProviders>
<add entityId="https://stubidp.sustainsys.com/Metadata"
signOnUrl="https://stubidp.sustainsys.com"
logoutUrl="https://stubidp.sustainsys.com/Logout"
allowUnsolicitedAuthnResponse="true"
binding="HttpRedirect"
wantAuthnRequestsSigned="true">
<signingCertificate storeName="CertificateAuthority" storeLocation="CurrentUser"
findValue="cdf7090a433561a843b51198b0ba6456" x509FindType="FindBySerialNumber" />
</add>
</identityProviders>
<serviceCertificates>
<add storeName="CertificateAuthority" storeLocation="CurrentUser" findValue="2cfe21cb930c19a341e9e30a07a3c123" x509FindType="FindBySerialNumber" />
</serviceCertificates>
</sustainsys.saml2>
You can use the LogoutCommandResultCreated notification. It will get called both when the redirect to the Idp is about to happen as well as after the response has been received from the Idp.

Zk Notify multiple view

I'm working on a project using zk framework. I have many users who can use the application at the same time.
If one of them change a value of a field and fire the #notifychange I want to update the views of all other users.
For example if all the users are in the same page
<window title="Search" width="600px" border="normal"
apply="org.zkoss.bind.BindComposer"
viewModel="#id('vm') #init('demo.getting_started.mvvm.SearchViewModel')"
binder="#id('b') #init('demo.getting_started.mvvm.AnnotateBinderExt',queueName='myqueue',queueScope='session')">
<hbox align="center">
Keyword:
<textbox id="txt" value="#bind(vm.keyword)" />
Result:
<textbox value="#load(vm.keyword)" />
</hbox></window>
and one of them change the value of the textfield I want update the value of the label for the other users.
I'm trying to work with the eventQueue but couldn't out how to implement it.
Your almost there.
The reason why it doesn't change is because #notifychange is propably called from a Command in stead of a GlobalCommand.
Take a look at this small talk what I wrote.
#Command is always the same viewmodel, #GlobalCommand can reach out to other viewmodels in the binders scope.

Orbeon 4.9 strange client-side javascript error

Another migration issue. I have changed orbeon forms version from 3.8 to 4.9.
One of my xforms isn't working after migration, this button freezes form with "xforms-loading-loading" span visible. There are no errors on the server side. Both submissions from this action are getting WSDL/SCHEMA from exist and replaces two xform instances. It is working correctly as I can see with inspector. The only error i can see is Javascript Error "TypeError: "spanContainer is undefined" from line 120 orbeon...*js. spanContainer.appendChild(templateClone) this is the part of code that crashes my application.
<xf:trigger ref="instance('page')/edition-valid">
<xf:label>EDIT</xf:label>
<xf:action ev:event="DOMActivate">
<xf:send submission="get-wsdl" />
<xf:send submission="get-schema" />
<xf:action if="not(instance('schema')//xsd:appinfo[text()='imported'])">
<xf:setvalue ref="instance('page')/edition/operation"
value="instance('wsdl')//wsdl:portType[1]/wsdl:operation[1]/#name" />
<xf:setvalue ref="instance('page')/edition/cdm"
value="if (instance('page')/edition/adapter='') then 'true' else ()" />
<xf:toggle case="edition" />
</xf:action>
</xf:action>
</xf:trigger>
What is wrong?

CRM 2011: Global JavaScript and button in status bar

I'm not so new in CRM 2011, but I faced with one big problem... I found some solution on net that makes some scoring/ranking system in CRM. I was completely confused when I saw star in top status bar, above ribbon buttons bar, next to username on right corner of screen.
When I click on this button, I open div with some information about users, and scores they have.
Where I can put Java Script function (jQuery for example) that can be executed globally? How to call that function, what event to catch? I need this button/function be active on all pages in CRM like this one.
What is id of that place in top bar? I need it to put this button from my script.
The CRM solution you appear to be talking about is this
http://www.wave-access.com/Public_en/ms_crm_gamification_product.aspx
This is obviously unsupported.
However they achieve it by adding a dummy button to the ribbon, specifically the Jewel Menu.
This button command is linked to a JS function in a webresource.
The button is always hidden but the JS file is always loaded.
It should be noted that your JS is loaded into Main.aspx (the root document)
From there its a matter of injecting HTML elements or javascript into the desired frame. (Nav or Content)
Here is the RibbonDiffXML to add to a solution.
<RibbonDiffXml>
<CustomActions>
<CustomAction Id="Dummy.CustomAction" Location="Mscrm.Jewel.Controls1._children" Sequence="41">
<CommandUIDefinition>
<Button Id="Dummy" Command="Dummy.Command" Sequence="50" ToolTipTitle="$LocLabels:Dummy.LabelText" LabelText="$LocLabels:Dummy.LabelText" ToolTipDescription="$LocLabels:Dummy.Description" TemplateAlias="isv" />
</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
</Templates>
<CommandDefinitions>
<CommandDefinition Id="Dummy.Command">
<EnableRules />
<DisplayRules>
<DisplayRule Id="Dummy.Command.DisplayRule.PageRule" />
</DisplayRules>
<Actions>
<JavaScriptFunction Library="$webresource:MyGlobal.js" FunctionName="Anything" />
</Actions>
</CommandDefinition>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules>
<DisplayRule Id="Dummy.Command.DisplayRule.PageRule">
<PageRule Address="aaaa" />
</DisplayRule>
</DisplayRules>
<EnableRules />
</RuleDefinitions>
<LocLabels>
<LocLabel Id="Dummy.Description">
<Titles>
<Title languagecode="1033" description="Description" />
</Titles>
</LocLabel>
<LocLabel Id="Dummy.LabelText">
<Titles>
<Title languagecode="1033" description="Description" />
</Titles>
</LocLabel>
</LocLabels>
This goes in the root ImportExportXml element of the customizations.xml
You may also need to add Application Ribbons as a solution component via the UI

Resources