NHibernate retrieve more than one tables records - c#-4.0

I am new in NHibernate.i am facing problem with nhibernate when i hit query on main table it gives me main table records but as well as it is also giving me related linked object tables records.So because of this more sql query hit on database.
which decrease performance of my query.i want only main table records and not fired any other query from database.
I want TAPVendor table records only
Below is my C# code from where i am fired query from database
var lstTAPVendor = session.Query< TAPVendor >()
i have also attached the .hbm file of tapvendor
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping namespace="M3.Entities" assembly="M3.Entities" xmlns="urn:nhibernate-mapping-2.2">
<class name="TAPVendor" table="tAPVendor" schema="dbo">
<id name="FVendorID" type="Guid">
<generator class="assigned" />
</id>
<version name="FTimestamp" generated="always" unsaved-value="null" type="BinaryBlob">
<column name="FTimestamp" not-null="true" sql-type="timestamp"/>
</version>
<property name="FActive" type="Boolean" not-null="true" />
<property name="FTermsType" type="Int32" precision="10" not-null="true" />
<property name="FACHPayment" type="Boolean" not-null="true" />
<property name="FCompanyName" type="String" length="50" not-null="true" />
<property name="FAccrueUseTax" type="Boolean" not-null="true" />
<property name="FSinglePaymentVendor" type="Boolean" not-null="true" />
<property name="FACHEnabled" type="Boolean" not-null="true" />
<property name="FCheckPerInvoice" type="Boolean" not-null="true" />
<property name="FBankAccountType" type="Int32" precision="10" not-null="true" />
<property name="FBankAccountName" type="String" length="50" />
<property name="FBankAccountNumber" type="String" length="50" />
<property name="FBankABANumber" type="String" length="50" />
<property name="FLegalName" type="String" length="50" />
<property name="FDateAdded" type="DateTime" />
<property name="FAddedBy" type="String" length="50" />
<property name="FDateModified" type="DateTime" />
<property name="FModifiedBy" type="String" length="50" />
<property name="FAccountNo" type="Double" precision="53" />
<property name="FDescription" type="String" length="100" />
<property name="FTerms" type="Int32" precision="10" />
<property name="F1099Box" type="Int16" precision="5" />
<property name="F1099Type" type="String" length="15" />
<property name="FTaxID" type="String" length="10" />
<property name="FSSN" type="String" length="11" />
<property name="FVendorNo" type="String" length="10" />
<property name="FAccountNo2" type="Double" precision="53" not-null="false" />
<property name="FIsUseAccountNo2" type="Boolean" not-null="true" />
<many-to-one name="TAddres" class="TAddres" column="fAddressID" />
<many-to-one name="TSCCompany" class="TSCCompany" column="fCompanyID" />
<many-to-one name="TContact" class="TContact" column="fContactID" />
<many-to-one name="TSCEnterprise" class="TSCEnterprise" column="fEnterpriseID" />
<many-to-one name="TSCProperty" class="TSCProperty" column="fPropertyID" />
<set name="TAPInvoices" table="tAPInvoice" inverse="true">
<key column="fVendorID" />
<one-to-many class="TAPInvoice" />
</set>
<set name="TBAChecks" table="tBACheck" inverse="true">
<key column="fVendorID" />
<one-to-many class="TBACheck" />
</set>
<set name="TAPRecurringInvoices" table="tAPRecurringInvoice" inverse="true">
<key column="fVendorID" />
<one-to-many class="TAPRecurringInvoice" />
</set>
<set name="TGLPostMasters" table="tGLPostMaster" inverse="true">
<key column="fVendorID" />
<one-to-many class="TGLPostMaster" />
</set>
</class>
</hibernate-mapping>

There are some solutions, from easy to hard -
1. Remove the <set> mappings, or create another entity without them.
2. Set all <set lazy="true">...</set> the fetch will occur only on accessing these properties.
3. Create a DTO (data transfer object) entity, a lite version, and use to NHibernate.Projections library to fetch properties selectively.
4. Set <set fetch="join">...</set> to fetch all data in one joined query, this might duplicate your records, so be careful.
And in general, NH separating the queries is not necessarily bad, JOIN on big tables can cause much bigger performance hit. Your issues might not be a mapping issue, it might be DB or code issue.

Related

Unkown node in applicationHost.config of IIS. Leaving website and app pool in unstable condition

Please help us out in understanding what this node in the applicationHost.config mean:
Basically we need to know what are these property ids? I guess they are leaving the website in an unstable condition and most probably corrupting the bindings.
<customMetadata>
<key path="LM/W3SVC">
<property id="130001" dataType="String" userType="2" attributes="Inherit" value="BITS-Sessions" />
<property id="130002" dataType="String" userType="2" attributes="Inherit" value="18446744073709551615" />
<property id="130003" dataType="DWord" userType="2" attributes="Inherit" value="1209600" />
<property id="130004" dataType="DWord" userType="2" attributes="Inherit" value="0" />
<property id="130005" dataType="String" userType="2" attributes="Inherit" value="" />
<property id="130007" dataType="String" userType="2" attributes="Inherit" value="" />
<property id="130008" dataType="DWord" userType="2" attributes="Inherit" value="86400" />
<property id="130010" dataType="DWord" userType="2" attributes="Inherit" value="0" />
<property id="130011" dataType="DWord" userType="2" attributes="Inherit" value="1" />
<property id="130012" dataType="DWord" userType="2" attributes="Inherit" value="12" />
<property id="130013" dataType="DWord" userType="2" attributes="Inherit" value="1" />
<property id="130014" dataType="DWord" userType="2" attributes="Inherit" value="0" />
<property id="130015" dataType="DWord" userType="2" attributes="Inherit" value="0" />
<property id="130016" dataType="DWord" userType="2" attributes="Inherit" value="0" />
<property id="130017" dataType="DWord" userType="2" attributes="Inherit" value="50" />
<property id="130018" dataType="DWord" userType="2" attributes="Inherit" value="0" />
<property id="2073" dataType="MultiSZ" userType="1" attributes="Inherit" value="C:\windows\system32\bitssrv.dll
" />
</key>
<key path="LM/W3SVC/INFO">
<property id="4012" dataType="String" userType="1" attributes="Inherit" value="NCSA Common Log File Format,Microsoft IIS Log File Format,W3C Extended Log File Format,ODBC Logging" />
<property id="2120" dataType="MultiSZ" userType="1" attributes="None" value="400,0,,,0
" />
</key>
</customMetadata>

Missing messages usingSpring Integration amqp:outbound-channel-adapter on RabbitMQ

On Publishing the message to Rabbit MQ Exchange, few of the messages are getting lost. For example, posted 10 messages only five got delivered to the binded queue and the rest 5 messages are lost. Please advice.
Below is Spring XML configuration for connection
<bean id="cachingConnectionFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory" destroy-method="destroy">
<property name="addresses" value="example.com:8080"/>
<property name="username" value="guest" />
<property name="password" value="guest" />
<property name="virtualHost" value="guest-app" />
<property name="connectionTimeout" value="1000"/>
<property name="cacheMode" value="#{T(org.springframework.amqp.rabbit.connection.CachingConnectionFactory.CacheMode).CONNECTION}"/>
<property name="channelCacheSize" value="6000"/>
<property name="channelCheckoutTimeout" value="60000"/>
<property name="requestedHeartBeat" value="30"/>
<property name="publisherConfirms" value="true"/>
<property name="publisherReturns" value="true"/>
</bean>
Below is Rabbit Template Config
<rabbit:template id="amqpTemplate" connection-factory="cachingConnectionFactory" mandatory="true" retry-template="retryTemplate" />
<bean id="retryTemplate" class="org.springframework.retry.support.RetryTemplate">
<property name="backOffPolicy">
<bean class="org.springframework.retry.backoff.ExponentialBackOffPolicy">
<property name="initialInterval" value="500" />
<property name="multiplier" value="10.0" />
<property name="maxInterval" value="10000" />
</bean>
</property>
</bean>
<rabbit:admin connection-factory="cachingConnectionFactory" />
Below is for Publishing message
int:chain input-channel="output">
<int:header-enricher>
<int:header name="amqp_deliveryMode" value="PERSISTENT" type="org.springframework.amqp.core.MessageDeliveryMode"/>
</int:header-enricher>
<int-amqp:outbound-channel-adapter id="outboundAmqp" amqp-template="amqpTemplate" exchange-name-expression="headers['exchange']" routing-key-expression="headers['routingKey']" mapped-request-headers="*" confirm-correlation-expression="payload" confirm-ack-channel="msgResponse" confirm-nack-channel="msgResponse" return-channel="msgResponse"/>

How to add default association data to Sharepoint Workflow without Association Form

I would like to know how to add default association data to Sharepoint Workflow developed in Visual studio, without any Association Form.
The problem is that i have 2 subscriptions to different lists for the same workflow, and i would like to add different default parameters values to each subscription.
Is it possible to do it directly in the Elements.xml file?
My current XML file look so:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="Workflow" Url="wfsvc/c7f7e1db60fe427084c8b9f1720b613e">
<File Url="Workflow.xaml" Type="GhostableInLibrary" Path="Workflow\Workflow.xaml" DoGUIDFixUp="TRUE">
<Property Name="ContentType" Value="WorkflowServiceDefinition" />
<Property Name="Libreria" Value="List1" />
<Property Name="isReusable" Value="true" />
<Property Name="RequiresInitiationForm" Value="False" />
<Property Name="RequiresAssociationForm" Value="False" />
<Property Name="WSPublishState" Value="3" />
<Property Name="WSDisplayName" Value="Workflow" />
<Property Name="WSDescription" Value="Description" />
<Property Name="RestrictToType" Value="List" />
<Property Name="RestrictToScope" Value="{$ListId:List1;}" />
<Property Name="InitiationUrl" Value="_layouts/15/Pages/WorkflowRedirect.aspx" />
</File>
<File Url="WorkflowStartAssociation" Path="Workflow\WorkflowStartAssociation" Type="GhostableInLibrary">
<Property Name="WSDisplayName" Value="Workflow" />
<Property Name="ContentType" Value="WorkflowServiceSubscription" />
<Property Name="WSPublishState" Value="3" />
<Property Name="WSEventType" Value="WorkflowStart" />
<Property Name="WSEnabled" Value="true" />
<Property Name="WSGUID" Value="88ae7a57-4a2c-4fa5-8488-71e6f504002f" />
<Property Name="WSEventSourceGUID" Value="{$ListId:List1;}" />
<Property Name="Microsoft.SharePoint.ActivationProperties.ListId" Value="{$ListId:List1;}" />
<Property Name="HistoryListId" Value="{$ListId:Lists/Workflow History;}" />
<Property Name="StatusColumnCreated" Value="1" />
</File>
</Module>
<Module Name="Workflow" Url="wfsvc/8EF78D6856824F36B1EC2014E89413B1">
<File Url="Workflow.xaml" Type="GhostableInLibrary" Path="Workflow\Workflow.xaml" DoGUIDFixUp="TRUE">
<Property Name="ContentType" Value="WorkflowServiceDefinition" />
<Property Name="Libreria" Value="List2" />
<Property Name="isReusable" Value="true" />
<Property Name="RequiresInitiationForm" Value="False" />
<Property Name="RequiresAssociationForm" Value="False" />
<Property Name="WSPublishState" Value="3" />
<Property Name="WSDisplayName" Value="Workflow" />
<Property Name="WSDescription" Value="Description" />
<Property Name="RestrictToType" Value="List" />
<Property Name="RestrictToScope" Value="{$ListId:List2;}" />
<Property Name="InitiationUrl" Value="_layouts/15/Pages/WorkflowRedirect.aspx" />
</File>
<File Url="WorkflowStartAssociation" Path="Workflow\WorkflowStartAssociation" Type="GhostableInLibrary">
<Property Name="WSDisplayName" Value="Workflow" />
<Property Name="ContentType" Value="WorkflowServiceSubscription" />
<Property Name="WSPublishState" Value="3" />
<Property Name="WSEventType" Value="WorkflowStart" />
<Property Name="WSEnabled" Value="true" />
<Property Name="WSGUID" Value="B9DAA949-99BD-46C0-9942-3D74F6CCDAD1" />
<Property Name="WSEventSourceGUID" Value="{$ListId:List2;}" />
<Property Name="Microsoft.SharePoint.ActivationProperties.ListId" Value="{$ListId:List2;}" />
<Property Name="HistoryListId" Value="{$ListId:Lists/Workflow History;}" />
<Property Name="StatusColumnCreated" Value="1" />
</File>
</Module>
<ListInstance FeatureId="{2c63df2b-ceab-42c6-aeff-b3968162d4b1}"
TemplateType="4501"
Title="wfsvc"
Description="This list instance is used by SharePoint to keep track of workflows. Do not modify."
Url="wfsvc"
RootWebOnly="FALSE" />
</Elements>
You can add any property in the WorkflowStartAssociation and then read them in your Workflow using the GetConfigurationValue activity

CQWP - displaying Author, Check Out To, etc... from multiple libraries

I have a CQWP that I created which lists the document icon, title, Author, Checked Out To, and Last Modified. Everything displays fine if I point it at a single document library but when I point it to the subsite, in order to see documents from all libraries, I get the icon and title but nothing else. What am I missing? Here is my code from the ItemStyle.xsl:
<xsl:if test="count(preceding-sibling::*)=0">
<div style="float:left; width:32px;"> </div>
<div style="float:left; width:15%; padding-right:15px;">Name</div>
<div style="float:left; width:10%; padding-right:15px;">Created By</div>
<div style="float:left; width:10%; padding-right:15px;">Checked Out</div>
<div style="float:left;">Last Modified</div>
</xsl:if>
<div class="item link-item">
<xsl:if test="string-length(#DocumentIconImageUrl) != 0">
<div class="image-area-left" style="width:25px;">
<img class="image" src="{#DocumentIconImageUrl}" title="" />
</div>
</xsl:if>
<div class="link-item">
<xsl:if test="count(preceding-sibling::*)=0">
</xsl:if>
<xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
<div style="float:left; width:15%; padding-right:15px;">
<a href="{$SafeLinkUrl}" title="{#LinkToolTip}">
<xsl:if test="$ItemsHaveStreams = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of select="#OnClickForWebRendering"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$ItemsHaveStreams != 'True' and #OpenInNewWindow = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="$DisplayTitle"/>
</a>
</div>
<div style="float:left; width:10%; padding-right:15px;">
<xsl:value-of select="#Author" />
</div>
<div style="float:left; width:10%; padding-right:15px;">
<xsl:choose>
<xsl:when test="string-length(#CheckoutUser) = 0">
Checked In
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="#CheckoutUser" />
</xsl:otherwise>
</xsl:choose>
</div>
<div style="float:left;"><xsl:value-of select="ddwrt:FormatDate(#Modified, 1033, 2)" /></div>
</div>
</div>
here is the code from my CQWP:
<metaData>
<type name="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="Filter1ChainingOperator" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterChainingOperator, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">And</property>
<property name="FilterOperator1" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterFieldQueryOperator, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Eq</property>
<property name="Direction" type="direction">NotSet</property>
<property name="FilterOperator3" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterFieldQueryOperator, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Eq</property>
<property name="GroupByDirection" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+SortDirection, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Desc</property>
<property name="DataSourceID" type="string" />
<property name="ChromeState" type="chromestate">Normal</property>
<property name="SystemViewFields" type="string" />
<property name="ListName" type="string" />
<property name="FilterDisplayValue3" type="string" />
<property name="FilterDisplayValue2" type="string" />
<property name="FilterDisplayValue1" type="string">In Progress</property>
<property name="FilterField1" type="string">{6e2d20e1-63ca-44c4-a57f-1f934d7f92ab}</property>
<property name="Description" type="string">Displays a dynamic view of content from your site.</property>
<property name="DataColumnRenames" type="string" />
<property name="MissingAssembly" type="string">Cannot import this Web Part.</property>
<property name="PageSize" type="int">-1</property>
<property name="ViewContentTypeId" type="string" />
<property name="ParameterBindings" type="string" />
<property name="HelpUrl" type="string" />
<property name="AdditionalFilterFields" type="string" />
<property name="DataMappingViewFields" type="string">{94f89715-e097-4e8b-ba79-ea02aa8b7adb},Lookup;{b9e6f3ae-5632-4b13-b636-9d1a2bd67120},Computed;{543bc2cf-1f30-488e-8f25-6fe3b689d9ac},Image;{fa564e0f-0c70-4ab9-b863-0177e6ddd247},Text;{691b9a4b-512e-4341-b3f1-68914130d5b2},Text;{1df5e554-ec7e-46a6-901d-d85a3881cb18},User;</property>
<property name="Title" type="string">In Progress</property>
<property name="FeedDescription" type="string" />
<property name="UseCache" type="bool">True</property>
<property name="XslLink" type="string" null="true" />
<property name="AutoRefresh" type="bool">False</property>
<property name="Filter1IsCustomValue" type="bool">False</property>
<property name="FireInitialRow" type="bool">True</property>
<property name="FilterValue3" type="string" />
<property name="SortByFieldType" type="string">DateTime</property>
<property name="ManualRefresh" type="bool">False</property>
<property name="HelpMode" type="helpmode">Modeless</property>
<property name="AllowConnect" type="bool">True</property>
<property name="ItemStyle" type="string">WithDocIcon</property>
<property name="SampleData" type="string"><dsQueryResponse>
<Rows>
<Row Title="Item 1" LinkUrl="http://Item1" Group="Group Header" __begincolumn="True" __begingroup="True" />
<Row Title="Item 2" LinkUrl="http://Item2" __begincolumn="False" __begingroup="False" />
<Row Title="Item 3" LinkUrl="http://Item3" __begincolumn="False" __begingroup="False" />
</Rows>
</dsQueryResponse></property>
<property name="FilterIncludeChildren2" type="bool">False</property>
<property name="XmlDefinitionLink" type="string" />
<property name="ServerTemplate" type="string">101</property>
<property name="TitleUrl" type="string" />
<property name="CommonViewFields" type="string">Modified,DateTime,;Modified By,User;Checked Out To, User;Check In Comment, Lookup;Author,User</property>
<property name="QueryOverride" type="string" />
<property name="DataSourcesString" type="string" />
<property name="DisplayName" type="string" />
<property name="ListGuid" type="string" />
<property name="DataFields" type="string" />
<property name="ShowWithSampleData" type="bool">False</property>
<property name="GroupByFieldType" type="string" />
<property name="Default" type="string" />
<property name="ViewFlags" type="Microsoft.SharePoint.SPViewFlags, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">None</property>
<property name="ContentTypeBeginsWithId" type="string" />
<property name="AllowHide" type="bool">True</property>
<property name="FeedEnabled" type="bool">False</property>
<property name="SortBy" type="string">{8c06beca-0777-48f7-91c7-6da68bc07b69}</property>
<property name="FilterByContextTerm" type="bool">False</property>
<property name="TitleIconImageUrl" type="string" />
<property name="PlayMediaInBrowser" type="bool">True</property>
<property name="ViewFlag" type="string">0</property>
<property name="Xsl" type="string"><xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cmswrt="http://schemas.microsoft.com/WebPart/v3/Publishing/runtime" exclude-result-prefixes="xsl cmswrt x" > <xsl:import href="/Style Library/XSL Style Sheets/Header.xsl" /> <xsl:import href="/Style Library/XSL Style Sheets/ItemStyle.xsl" /> <xsl:import href="/Style Library/XSL Style Sheets/ContentQueryMain.xsl" /> </xsl:stylesheet></property>
<property name="FilterField2" type="string" />
<property name="ChromeType" type="chrometype">TitleOnly</property>
<property name="CacheXslTimeOut" type="int">86400</property>
<property name="AdditionalGroupAndSortFields" type="string" />
<property name="UseSQLDataSourcePaging" type="bool">True</property>
<property name="Height" type="string" />
<property name="DataMappings" type="string">Author:|Modified:|Description:{691b9a4b-512e-4341-b3f1-68914130d5b2},ShortComment,Text;{1df5e554-ec7e-46a6-901d-d85a3881cb18},Author,User;|Title:{fa564e0f-0c70-4ab9-b863-0177e6ddd247},Title,Text;|CheckoutUser:|LinkUrl:{94f89715-e097-4e8b-ba79-ea02aa8b7adb},FileRef,Lookup;|ImageUrl:{b9e6f3ae-5632-4b13-b636-9d1a2bd67120},EncodedAbsThumbnailUrl,Computed;{543bc2cf-1f30-488e-8f25-6fe3b689d9ac},PublishingRollupImage,Image;|</property>
<property name="ListUrl" type="string" null="true" />
<property name="ShowUntargetedItems" type="bool">False</property>
<property name="AllowMinimize" type="bool">True</property>
<property name="GroupBy" type="string" />
<property name="FilterIncludeChildren1" type="bool">False</property>
<property name="BaseType" type="string" />
<property name="MainXslLink" type="string" />
<property name="AsyncRefresh" type="bool">False</property>
<property name="FilterValue1" type="string">In Progress</property>
<property name="FilterValue2" type="string" />
<property name="InitialAsyncDataFetch" type="bool">False</property>
<property name="AutoRefreshInterval" type="int">60</property>
<property name="Filter3IsCustomValue" type="bool">False</property>
<property name="GroupStyle" type="string">DefaultHeader</property>
<property name="AllowZoneChange" type="bool">True</property>
<property name="FilterIncludeChildren3" type="bool">False</property>
<property name="EnableOriginalValue" type="bool">False</property>
<property name="ItemLimit" type="int">15</property>
<property name="FilterType1" type="string">Choice</property>
<property name="UseCopyUtil" type="bool">False</property>
<property name="FilterType3" type="string" />
<property name="FilterType2" type="string" />
<property name="FilterOperator2" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterFieldQueryOperator, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Eq</property>
<property name="PageType" type="Microsoft.SharePoint.PAGETYPE, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">PAGE_NORMALVIEW</property>
<property name="FilterByAudience" type="bool">False</property>
<property name="ItemXslLink" type="string" />
<property name="Hidden" type="bool">False</property>
<property name="WebUrl" type="string">~sitecollection/dmwdocs</property>
<property name="HeaderXslLink" type="string" />
<property name="CacheXslStorage" type="bool">True</property>
<property name="ListsOverride" type="string" />
<property name="SortByDirection" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+SortDirection, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Desc</property>
<property name="Filter2IsCustomValue" type="bool">False</property>
<property name="AllowEdit" type="bool">True</property>
<property name="FeedTitle" type="string" />
<property name="FilterField3" type="string" />
<property name="MediaPlayerStyleSource" type="string" null="true" />
<property name="DisplayColumns" type="int">1</property>
<property name="Filter2ChainingOperator" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterChainingOperator, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Or</property>
<property name="XmlDefinition" type="string" />
<property name="WebsOverride" type="string" />
<property name="AllowClose" type="bool">True</property>
<property name="ContentTypeName" type="string" />
<property name="ListId" type="System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">00000000-0000-0000-0000-000000000000</property>
<property name="ExportMode" type="exportmode">All</property>
<property name="NoDefaultStyle" type="string" />
<property name="ViewFieldsOverride" type="string" />
<property name="CatalogIconImageUrl" type="string" />
<property name="ListDisplayName" type="string" null="true" />
<property name="Width" type="string" />
</properties>
</data>
Try editing web part property as shown in screen shot.CQWP
Here I have mentioned the column names explicitly in 'Fields to display' section. Please use display names.
In my case it was not showing Author(Created by) column .

Spring Integration Exception ignoring container setting on int-jms:message-driven-channel-adapter

As per my understanding, Runtime Exception in ServiceActivator should send message to errorChannel.
But if errorHandler is not set then that doesn't work. I even tried to set errorHandler
<bean id="translatorContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory" />
<property name="errorHandler" ref="myErrorHandler"/>
<property name="destination" ref="TRANSLATED-MDCAD" />
<property name="sessionTransacted" value="true" />
<property name="maxConcurrentConsumers" value="50" />
<property name="concurrentConsumers" value="1" />
<property name="receiveTimeout" value="5000" />
<property name="recoveryInterval" value="60000" />
<property name="autoStartup" value="false" />
</bean>
<int:channel id="TRANSLATED-MSG-CHANNEL"/>
<bean id="TRANSLATED-MDCAD" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value="TRANSLATED-MESSAGE-QUEUE" />
</bean>
<int-jms:message-driven-channel-adapter
id="MDB-TRANSLATED"
channel="TRANSLATED-MSG-CHANNEL" container="translatorContainer" acknowledge="transacted"/>
<int:service-activator input-channel="IN-MSG-CHANNEL"
output-channel="TRANSLATED-MSG-CHANNEL" ref="myProcess"
method="execute" />
But on RuntimeException in myProcess (ServiceActivator) then i am seeing following in log
WARN : [2014-03-16 00:11:51.219] org.springframework.jms.listener.DefaultMessageListenerContainer - Execution of JMS message listener failed, and no ErrorHandler has been set.
org.springframework.integration.MessagingException: failed to handle incoming JMS Message
at org.springframework.integration.jms.SubscribableJmsChannel$DispatchingMessageListener.onMessage(SubscribableJmsChannel.java:164)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:561)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:499)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1059)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1051)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:948)
at java.lang.Thread.run(Thread.java:662)
I have debugged DefaultMessageListenerContainer, JmsMessageDrivenEndpointParser and some other internal class and found that container is getting set correctly.
BUT when exception is thrown, it is using default container ( not the one i have set on int-jms:message-driven-channel-adapter : translatorContainer which has errorHandler set )
What could be the reason? Is there any other alternate setup I can try to redirect runtime exception to errorChannel? Let me know if you need more information
I am using spring integration version 2.2.5
#### DETAIL CONFIG
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
">
<bean id="connectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="hostName">
<value>${mq_hostname}</value>
</property>
<property name="port">
<value>${mq_port}</value>
</property>
<property name="queueManager">
<value>${mq_queuemanager}</value>
</property>
<property name="channel">
<value>${mq_channel}</value>
</property>
<property name="transportType" value="1" />
<property name="useConnectionPooling">
<value>true</value>
</property>
</bean>
<int:annotation-config />
<int:message-history />
<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="destination" ref="DEBATCHED-MDCAD" />
<property name="connectionFactory" ref="connectionFactory" />
<property name="errorHandler" ref="manifestErrorHandler"/>
<property name="sessionTransacted" value="true" />
<property name="maxConcurrentConsumers" value="50" />
<property name="concurrentConsumers" value="1" />
<property name="receiveTimeout" value="5000" />
<property name="recoveryInterval" value="60000" />
<property name="autoStartup" value="false" />
</bean>
</bean>
<bean id="translatorContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="destination" ref="TRANSLATED-MDCAD" />
<property name="connectionFactory" ref="connectionFactory" />
<property name="errorHandler" ref="manifestErrorHandler"/>
<property name="sessionTransacted" value="true" />
<property name="maxConcurrentConsumers" value="50" />
<property name="concurrentConsumers" value="1" />
<property name="receiveTimeout" value="5000" />
<property name="recoveryInterval" value="60000" />
<property name="autoStartup" value="false" />
</bean>
</bean>
<!-- Global Channel Interceptor -->
<int:channel-interceptor ref="metadataInterceptor"
pattern="*CHANNEL" order="1" />
<int:wire-tap pattern="*CHANNEL" order="1" channel="logger" />
<int:gateway id="manifestGateway"
service-interface="gov.dhs.cbp.manifest.oceanexport.gateway.ManifestGateway" error-channel="ERRORS-MSG-CHANNEL" />
<int:logging-channel-adapter id="logger"
level="ERROR" log-full-message="true" />
<int-jms:channel id="INBOUND-MSG-CHANNEL" queue-name="INBOUND" error-handler="manifestErrorHandler"/>
<int:channel id="DEBATCHED-MSG-CHANNEL" />
<bean id="DEBATCHED-MDCAD" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value="DEBATCHED" />
</bean>
<int-jms:message-driven-channel-adapter
id="MDB-DEBATCHED"
channel="DEBATCHED-MSG-CHANNEL" container="defaultMessageListenerContainer" acknowledge="transacted"/>
<bean id="manifestErrorHandler" class="gov.dhs.cbp.manifest.process.util.ManifestErrorHandler"/>
<int:channel id="TRANSLATED-MSG-CHANNEL"/>
<bean id="TRANSLATED-MDCAD" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value="TRANSLATED" />
</bean>
<int-jms:message-driven-channel-adapter
id="MDB-TRANSLATED"
channel="TRANSLATED-MSG-CHANNEL" container="translatorContainer" acknowledge="transacted"/>
<int:channel id="ERRORS-MSG-CHANNEL" />
<bean id="ERROR-EXTERNAL" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value="ERRORS" />
</bean>
<int-jms:outbound-channel-adapter id="ERROR-EXTERNAL-ADAPTER"
channel="ERRORS-MSG-CHANNEL" destination="ERROR-EXTERNAL" />
<int-jms:outbound-channel-adapter id="ERROR-CHANNEL-EXTERNAL-ADAPTER"
channel="errorChannel" destination="ERROR-EXTERNAL" />
<!-- ## Service Activator ## -->
<int:service-activator input-channel="DEBATCHED-MSG-CHANNEL"
output-channel="TRANSLATED-MSG-CHANNEL" ref="manifestProcess"
method="execute" />
<!-- DEBATCHER - SPLITTER -->
<int:splitter input-channel="INBOUND-MSG-CHANNEL"
output-channel="DEBATCHED-MSG-CHANNEL" ref="debatcherService"
method="execute" />
<!-- RESPONSE SERVICE / NOT ROUTER DUE TO BUSINESS LOGIC -->
<int:service-activator input-channel="TRANSLATED-MSG-CHANNEL" ref="responseService"
method="generateResponse"/>
<bean id="pool"
class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="8" />
</bean>
<!--
<bean id="retryTemplate" class="org.springframework.retry.support.RetryTemplate">
<property name="retryPolicy">
<bean class="org.springframework.retry.policy.SimpleRetryPolicy">
<property name="maxAttempts" value="4" />
</bean>
</property>
<property name="backOffPolicy">
<bean class="org.springframework.retry.backoff.ExponentialBackOffPolicy">
<property name="initialInterval" <value="1000" />
<property name="multiplier" value="5" />
</bean>
</property>
</bean>
-->
</beans>
USING RETRY template to solve the issue
<bean id="retryTemplate" class="org.springframework.retry.support.RetryTemplate">
<property name="retryPolicy">
<bean class="org.springframework.retry.policy.SimpleRetryPolicy">
<property name="maxAttempts" value="1" />
</bean>
</property>
<property name="backOffPolicy">
<bean class="org.springframework.retry.backoff.ExponentialBackOffPolicy">
<property name="initialInterval" value="1000" />
<property name="multiplier" value="5" />
</bean>
</property>
</bean>
<int:service-activator input-channel="DEBATCHED-MSG-CHANNEL"
output-channel="TRANSLATED-MSG-CHANNEL" ref="manifestProcess"
method="execute" >
<int:request-handler-advice-chain>
<bean class="org.springframework.integration.handler.advice.RequestHandlerRetryAdvice">
<property name="recoveryCallback">
<bean class="org.springframework.integration.handler.advice.ErrorMessageSendingRecoverer">
<constructor-arg ref="errorChannel" />
</bean>
</property>
<property name="retryTemplate" ref="retryTemplate" />
</bean>
</int:request-handler-advice-chain>
</int:service-activator>
As we see by your StackTrace the issue is around SubscribableJmsChannel (<int-jms:channel id="fooChannel" queue-name="foo"/>), where you don't use a custom container.
But you show a config for <int-jms:message-driven-channel-adapter>.
So, be careful analyzing the issue.
Now, if you want the same behaviour for <int-jms:channel/> you can inject your myErrorHandler to the channel's property error-handler

Resources