I want to use Infinispan JDBC Cache Store instead of LevelDb Cache Store.
Here's below my configuration:
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:6.0 http://www.infinispan.org/schemas/infinispan-config-6.0.xsd
urn:infinispan:config:jdbc:6.0 http://www.infinispan.org/schemas/infinispan-cachestore-jdbc-config-6.0.xsd"
xmlns="urn:infinispan:config:6.0"
xmlns:jdbc="urn:infinispan:config:jdbc:6.0" >
<global>
<globalJmxStatistics enabled="false" allowDuplicateDomains="true"/>
</global>
<!-- Define the cache loaders (i.e., cache stores). Passivation is false
because we want *all* data to be persisted, not just what doesn't fit
into memory. -->
<persistence>
<mixedKeyedJdbcStore fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
<simpleConnection connectionUrl="jdbc:postgresql://localhost:5432/infinispan_binary_based" driverClass="org.postgresql.Driver" username="postgres" password="postgres"/>
<stringKeyedTable prefix="ISPN_MIXED_STR_TABLE" createOnStart="true" dropOnExit="true">
<idColumn name="ID_COLUMN" type="VARCHAR(255)" />
<dataColumn name="DATA_COLUMN" type="BINARY" />
<timestampColumn name="TIMESTAMP_COLUMN" type="BIGINT" />
</stringKeyedTable>
<binaryKeyedTable prefix="ISPN_MIXED_BINARY_TABLE" createOnStart="true" dropOnExit="true">
<idColumn name="ID_COLUMN" type="VARCHAR(255)" />
<dataColumn name="DATA_COLUMN" type="BINARY" />
<timestampColumn name="TIMESTAMP_COLUMN" type="BIGINT" />
</binaryKeyedTable>
</mixedKeyedJdbcStore>
</persistence>
</namedCache>
but I keep getting this exception:
Message: Unexpected element '{urn:infinispan:config:jdbc:6.0}mixedKeyedJdbcStore'
at org.infinispan.configuration.parsing.ParserRegistry.parseElement(ParserRegistry.java:139) [infinispan-core-6.0.2.Final.jar:6.0.2.Final]
at org.infinispan.configuration.parsing.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:37) [infinispan-core-6.0.2.Final.jar:6.0.2.Final]
at org.infinispan.configuration.parsing.Parser60.parsePersistence(Parser60.java:558) [infinispan-core-6.0.2.Final.jar:6.0.2.Final]
I removed leveldb cache store jar from my dependencies and replace it with jdbc cache store jar.
Could you tell me if I missed anything?
Help please?
Thank you in advance.
You're declaring a namespace called jdbc, but not using it. You need to either prefix all the tags in mixedKeyedJdbcStore with jdbc:, or use a default namespace like this:
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:6.0 http://www.infinispan.org/schemas/infinispan-config-6.0.xsd
urn:infinispan:config:jdbc:6.0 http://www.infinispan.org/schemas/infinispan-cachestore-jdbc-config-6.0.xsd"
xmlns="urn:infinispan:config:6.0"
xmlns:jdbc="urn:infinispan:config:jdbc:6.0" >
<global>
<globalJmxStatistics enabled="false" allowDuplicateDomains="true"/>
</global>
<!-- Define the cache loaders (i.e., cache stores). Passivation is false
because we want *all* data to be persisted, not just what doesn't fit
into memory. -->
<namedCache name="testCache">
<persistence>
<mixedKeyedJdbcStore xmlns="urn:infinispan:config:jdbc:6.0" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
<simpleConnection connectionUrl="jdbc:postgresql://localhost:5432/infinispan_binary_based" driverClass="org.postgresql.Driver" username="postgres" password="postgres"/>
<stringKeyedTable prefix="ISPN_MIXED_STR_TABLE" createOnStart="true" dropOnExit="true">
<idColumn name="ID_COLUMN" type="VARCHAR(255)" />
<dataColumn name="DATA_COLUMN" type="BINARY" />
<timestampColumn name="TIMESTAMP_COLUMN" type="BIGINT" />
</stringKeyedTable>
<binaryKeyedTable prefix="ISPN_MIXED_BINARY_TABLE" createOnStart="true" dropOnExit="true">
<idColumn name="ID_COLUMN" type="VARCHAR(255)" />
<dataColumn name="DATA_COLUMN" type="BINARY" />
<timestampColumn name="TIMESTAMP_COLUMN" type="BIGINT" />
</binaryKeyedTable>
</mixedKeyedJdbcStore>
</persistence>
</namedCache>
Your configuration was also missing a starting namedCache tag, but I assume it was a copypaste mistake, otherwise the error message would be different.
Related
I have configured Hibernate Search to use infinispan and use File System based Cache Store to persist the indexes in file system instead of memory.
Now, I wish to configure S3 instead of File System, but I am not able to find the correct configuration for this.
My infinispan.xml file is:
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:6.0 http://www.infinispan.org/schemas/infinispan-config-6.0.xsd"
xmlns="urn:infinispan:config:6.0">
<global>
<globalJmxStatistics enabled="false" />
<!-- <transport clusterName="storage-test-cluster" /> -->
<shutdown hookBehavior="DONT_REGISTER" />
</global>
<default>
<storeAsBinary
enabled="false" />
<locking
isolationLevel="READ_COMMITTED"
lockAcquisitionTimeout="20000"
writeSkewCheck="false"
concurrencyLevel="5000"
useLockStriping="false" />
<invocationBatching
enabled="false" />
</default>
<namedCache name="LuceneIndexesMetadata">
<persistence passivation="false">
<singleFile
fetchPersistentState="true"
preload="true"
purgeOnStartup="false"
shared="true"
ignoreModifications="false"
location="C:\\infinispan">
</singleFile>
</persistence>
</namedCache>
<namedCache name="LuceneIndexesData">
<persistence passivation="false">
<singleFile
fetchPersistentState="true"
preload="true"
purgeOnStartup="false"
shared="true"
ignoreModifications="false"
location="C:\\infinispan">
</singleFile>
</persistence>
</namedCache>
<namedCache name="LuceneIndexesLocking">
<!-- No CacheLoader configured here -->
</namedCache>
</infinispan>
Can anyone help me in configuring this file to use Amazon S3 as Cache Store.
The specific versions of Hibernate Search and Infinispan which you're using are extremely old. Specifically, Infinispan didn't support storage on Amazon S3 in version 6.
I would suggest upgrading to some more recent version which is still being maintained.
As of writing this, you could use Infinispan 9.1.5.Final with Hibernate Search 5.8.2.Final.
I am using Mule as ESB solution. I have a queue, from where i am getting messages and trying to make http request to service that is failing all the time.
I have configured the RedeliveryPolicy on ActiveMQ like this:
<spring:bean id="retryRedeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy"
name="retryRedeliveryPolicy">
<spring:property name="maximumRedeliveries" value="76" />
<spring:property name="initialRedeliveryDelay" value="300000" />
<spring:property name="maximumRedeliveryDelay" value="3600000" />
<spring:property name="useExponentialBackOff" value="true" />
<spring:property name="backOffMultiplier" value="2" />
<spring:property name="queue" value="*" />
</spring:bean>
It retries after 5min. then 10min ,20,40,60,60,60... For about ~ 3days
The problem is, that Retry logic is non persistent.
Lets say, message was retrying for 2 days. And i have deployed new version of mule app, or restarted server... In this case, retry logic will start all over again from 5min, 10min.... Because retry state is kept in RAM memory by the Client.
Hot to make RedeliveryPolicy persistent? It must keep retrying for 1 more day after i will restart the server after 2 days.
One solution i think might be to set timeToLive for 72 hours for message. But even then after restarting server. It will not retry every hour from start. It will start from 5min...
You can use the JMSXDeliveryCount property of the JMS message to check how many times it has been retried already. The retry time interval logic should rely on the JMSXDeliveryCount variable.
message.getIntProperty("JMSXDeliveryCount ")
http://activemq.apache.org/activemq-message-properties.html
ActiveMQ has a way to do persistent redelivery, but it's not built in using the RedeliveryPolicy on the ConnectionFactory, which is intended for short periods of redelivery before failing.
Persistent redelivery can be built using the the ActiveMQ scheduler and delayed messages however. A bit manual, but doable. Make sure you turn on schedulerSupport="true" in ActiveMQ before trying this.
A JMS property: "delivery" keeps track of number of retries and if things go wrong a catch exception strategy redelivers the message a number of times with a delay. The actual delay is handled by ActiveMQ, so this flow can handle delays of hours, days etc and withstand restarts of both ActiveMQ and Mule.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd">
<spring:beans>
<spring:bean name="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
<spring:property name="maximumRedeliveries" value="0" />
</spring:bean>
<spring:bean name="cf"
class="org.apache.activemq.ActiveMQConnectionFactory">
<spring:property name="brokerURL" value="tcp://localhost:61616" />
<spring:property name="redeliveryPolicy" ref="redeliveryPolicy" />
</spring:bean>
</spring:beans>
<jms:activemq-connector name="Active_MQ"
specification="1.1" brokerURL="tcp://localhost:61616"
validateConnections="true" doc:name="Active MQ" numberOfConsumers="1"
maxRedelivery="-1" connectionFactory-ref="cf" />
<flow name="testFlow">
<jms:inbound-endpoint queue="IN" connector-ref="Active_MQ"
doc:name="JMS">
<jms:transaction action="ALWAYS_BEGIN" />
</jms:inbound-endpoint>
<set-property propertyName="delivery"
value="#[message.inboundProperties['delivery'] or 0]" doc:name="Property" />
<scripting:component doc:name="Throw Error">
<scripting:script engine="Groovy"><![CDATA[throw new java.lang.RuntimeException("Error in processing")]]></scripting:script>
</scripting:component>
<choice-exception-strategy doc:name="Choice Exception Strategy">
<catch-exception-strategy doc:name="Catch Exception Strategy"
when="#[message.outboundProperties['delivery'] < 5]">
<logger level="ERROR"
message="Retry once more count #[message.outboundProperties['delivery']]"
doc:name="Logger" />
<set-property propertyName="AMQ_SCHEDULED_DELAY" value="3000"
doc:name="Property" />
<set-property propertyName="delivery"
value="#[message.outboundProperties['delivery'] + 1]" doc:name="Property" />
<jms:outbound-endpoint queue="IN"
connector-ref="Active_MQ" doc:name="JMS">
<jms:transaction action="ALWAYS_JOIN" />
</jms:outbound-endpoint>
</catch-exception-strategy>
<rollback-exception-strategy doc:name="Rollback Exception Strategy">
<logger level="ERROR" message="Giving up retry. Do whatever needed here." doc:name="Logger" />
</rollback-exception-strategy>
</choice-exception-strategy>
</flow>
</mule>
This is no way to make the RedeliveryPolicy persistent - it's controlled by the connection factory and the factory will get reset when you restart the server. The way you have it configured, it will carry on with the behaviour you see, as you have useExponentialBackOff set to true. You could set this to false to get the delay to be a regular amount, but that is the only change to make.
I think you have the right idea with setting the message TTL, at least this will remove the message after the specified time. The JMSXDeliveryCount is great, but it will remove after a number attempts, not a defined time period, if you increase the delay between the retries.
I have 2 spring integration context files using similar file-based integration pattern. Both scan directory looking for a message and both work if deployed by themselves. If I include both modules into another spring context they are loading without issues. However only second one is working, and the first one is getting: MessageDeliveryException: Dispatcher has no subscribers. I've attempted to combine them into a single context file with no positive gain. We are currently on version 2.1.3 of Spring Integration and version 2.1 of Spring Integration File. Any ideas are greatly appreciated!
inpayment-context.xml:
<!-- START of in-bound message implementation -->
<int:channel id="file-inpayment-channel" datatype="java.io.File" />
<bean id="xmlPatternFileListFilter" class="org.springframework.integration.file.filters.SimplePatternFileListFilter">
<constructor-arg value="*.xml" />
</bean>
<task:executor id="batchInBoundExecuter" pool-size="1-1" queue-capacity="20" rejection-policy="CALLER_RUNS" />
<int-file:inbound-channel-adapter directory="file:${inpayment.inbox}" filter="xmlPatternFileListFilter"
channel="file-inpayment-channel">
<int:poller id="inPaymentrPoller" fixed-delay="1000" task-executor="batchInBoundExecuter" default="true" />
</int-file:inbound-channel-adapter>
<bean id="inPaymentService" class="com.somepackage.InPaymentBootstrapService" />
<int:service-activator id="batchJobLaunchService" ref="inPaymentService" input-channel="file-inpayment-channel"
method="schedule" />
<!-- START of out-bound message implementation -->
<int:channel id="inpayment-file-out-channel" datatype="java.io.File" />
<int:gateway id="inboundPaymentGateway" service-interface="com.somepackage.InboundPaymentGateway"
default-request-channel="inpayment-file-out-channel" />
<int-file:outbound-channel-adapter directory="file:${inpayment.inprocess}" channel="inpayment-file-out-channel"
auto-create-directory="true" delete-source-files="true" />
<!-- END of out-bound message implementation -->
scheduler-context.xml:
<!-- START of in-bound message implementation -->
<int:channel id="scheduler-file-in-channel" datatype="java.io.File" />
<bean id="simplePatternFileListFilter" class="org.springframework.integration.file.filters.SimplePatternFileListFilter">
<constructor-arg value="*.xml" />
</bean>
<task:executor id="batchJobRunExecuter" pool-size="1-1" queue-capacity="20" rejection-policy="CALLER_RUNS"/>
<int-file:inbound-channel-adapter directory="file:${scheduler.inbox}" filter="simplePatternFileListFilter"
channel="scheduler-file-in-channel">
<int:poller id="schedulerPoller" fixed-delay="5000" task-executor="batchJobRunExecuter" default="true" />
</int-file:inbound-channel-adapter>
<bean id="launchService" class="com.somepackage.BatchJobLaunchService" />
<int:service-activator id="batchJobLaunchService" ref="launchService" input-channel="scheduler-file-in-channel"
method="schedule" />
<!-- END of in-bound message implementation -->
<!-- START of out-bound message implementation -->
<int:channel id="scheduler-file-out-channel" datatype="java.io.File" />
<int:channel id="scheduler-xml-out-channel" datatype="com.somepackage.ScheduledJob" />
<int:gateway id="batchJobSchedulerGateway" service-interface="com.innovation.customers.guideone.scheduler.integration.SchedulerGateway"
default-request-channel="scheduler-xml-out-channel" />
<int:transformer input-channel="scheduler-xml-out-channel" output-channel="scheduler-file-out-channel" ref="schedulerFileTransformer"
method="transformToFile" />
<int-file:outbound-channel-adapter directory="file:${scheduler.completed}" channel="scheduler-file-out-channel"
auto-create-directory="true" delete-source-files="true" />
<!-- END of out-bound message implementation -->
Common Spring Context:
<context:component-scan base-package="com.somepackage" />
<import resource="classpath:g1-scheduler-context.xml"/>
<import resource="classpath:g1-inpayment-context.xml"/>
EDIT
2014-08-27 11:01:01,530 ERROR [batchJobRunExecuter-1][:] org.springframework.integration.handler.LoggingHandler : org.springframework.integration.MessageDeliveryException: Dispatcher has no subscribers. at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:108) at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:101)
I see the issue in your config:
<int:service-activator id="batchJobLaunchService" ref="inPaymentService" input-channel="file-inpayment-channel"
method="schedule" />
and
<int:service-activator id="batchJobLaunchService" ref="launchService" input-channel="scheduler-file-in-channel"
method="schedule" />
They assume to be different services, but at the same time use the same id - batchJobLaunchService.
Spring by default allows to do that, but only the last bean definition with the same id wins. That's why the <service-activator> for the launchService hasn't been pupolated and hence the EventDrivenConsumer bean hasn't been subscribed to the scheduler-file-in-channel.
Be careful and use unique id for all your beans.
It isn't so easy to throw expection on the duplication case, but if you switch on INFO for the org.springframework category you'll the message that one bean overrrides another.
I need to connect a java metro client to a wcf service for a project I'm cuurently working on. I used the tutorial at click.
Everything seems to work properly until I want to add sessions to my service. When I add <reliableSession enabled="true" /> to my config file, the client isn't able to reload the wcf service.
config file:
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="false" logMalformedMessages="false"
logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="false" />
</diagnostics>
<services>
<service name="Service" behaviorConfiguration="ServiceBehavior">
<!-- Service Endpoints -->
<endpoint address="" bindingConfiguration="interopBinding" binding="metroBinding" contract="IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
<!-- To configure the service certificate -->
<serviceCredentials>
<serviceCertificate storeLocation="LocalMachine" storeName="Root" x509FindType="FindBySubjectDistinguishedName" findValue="CN=go2.openscrolling" />
<clientCertificate>
<authentication certificateValidationMode="PeerOrChainTrust" />
</clientCertificate>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<metroBinding>
<binding name="interopBinding" messageEncoding="Text">
<security mode="MutualCertificate" establishSecurityContext="false" algorithmSuite="Basic128"/>
<!--<reliableSession enabled="true" />-->
</binding>
</metroBinding>
</bindings>
<extensions>
<bindingExtensions>
<add name="metroBinding" type="Microsoft.ServiceModel.Interop.Metro.Configuration.MetroBindingCollectionElement, Microsoft.ServiceModel.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4fc38efee625237e"/>
</bindingExtensions>
</extensions>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
This is part of my jboss-esb.xml file:
<action name="HotelAvailRq_To_HotelAvailRequest" class="org.jboss.soa.esb.smooks.SmooksAction">
<property name="smooksConfig"
value="requestConverters/HotelAvailRq_To_HotelAvailRequest.xml" />
<property name="resultType"
value="JAVA" />
<!-- <property name="javaResultBeanId" value="hotel" /> -->
<!-- <property name="set-payload-location" value="map" /> -->
<property name="mappedContextObjects"
value="hotel,dateRange" />
<property name="reportPath"
value="C:\Documents and Settings\barrowj\esb-workspace\esb\smooks-in-report.html" />
</action>
<action name="print-result" class="org.jboss.soa.esb.actions.SystemPrintln" >
<property name="message" value="Read" />
<property name="printfull" value="true" />
</action>
<action name="availabilityCall"
class="org.jboss.soa.esb.actions.EJBProcessor">
<property name="ejb3" value="true" />
<property name="jndi-name" value="HotelBooking/remote" />
<property name="initial-context-factory"
value="org.jnp.interfaces.NamingContextFactory" />
<property name="provider-url" value="jnp://localhost:1099" />
<property name="method" value="availability" />
<property name="ejb-params">
<arg0 type="model.domain.Hotel">map.hotel</arg0>
<arg1 type="model.domain.value_objects.DateRange">body.map.dateRange</arg1>
<arg2 type="model.domain.value_objects.RoomRequest">roomRequest</arg2>
<arg3 type="model.domain.RatePlanList">ratePlanList</arg3>
<arg4 type="model.domain.AmenityList">amenityList</arg4>
<arg5 type="model.domain.types.Money">minimumRate</arg5>
<arg6 type="model.domain.types.Money">maximumRate</arg6>
<arg7 type="model.domain.Partner">partner</arg7>
</property>
</action>
The smooks call returns
body: [ objects:
{org.jboss.soa.esb.message.defaultEntry=
{ dateRange=DateRange [ thru=2010-03-24, from=2010-03-23],
roomRequest=RoomRequest [list=[GuestInfo [count=1, age=null]], numberOfRooms=1],
PTIME=null,
guestInfo=GuestInfo [count=1, age=null],
PUUID=null,
partner=Partner [partnerId=bukuser],
hotel=Hotel [id=61044, name=null, chainCode=BW, roomTypes=[], maxStay=P30D, bookings=[], ratePlans=[]],
guestInfoList=[GuestInfo [count=1, age=null]]},
SmooksExecutionContext={}} ]
So, I need to map the dateRange, roomRequest, guestInfo and the other EJB params to the EJB call. Is there a way to do this?
The documentation indicates you can, but doesn't say how to get a map value out of the context map in XML.
So the problem turns out to be the interaction between the smooks action and the ejb action. Smooks returns a hashmap of stuff. It puts that hashmap inside the message.body of the ESB. Which, in turn is a hashmap.
The ejb action is looking for message.getBody().get("name"), when it should be looking for message.getBody().get("smooksResults").get("name"). There is no way to tell the ejb action to look in there.
The only solution is to change the EJB action so it can look in the smooks results hashmap.