Announcement Announcement Module
Collapse
No announcement yet.
Wire-Tap Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wire-Tap

    If I configure wire-taps as follows, the channel marked "dossierInputChannel" does not receive any messages. However, changing the channel being used to wire-tap from a direct channel to a logging-channel-adapter channel makes it work. Can anybody see why?

    Thanks! K
    Not working:
    Code:
    	<channel id="dossierInputChannelEventSource"/>
    	
    	<channel id="dossierInputChannel">
    		<queue/>
    		<interceptors>
    	        <wire-tap channel="logHeaderChannel"/>
    	        <wire-tap channel="dossierInputChannelEventSource"/>
    	    </interceptors>
    	</channel>
    
    	<int-jdbc:outbound-channel-adapter
    		data-source="dataSource"
    		channel="dossierInputChannelEventSource"
    		query=	"INSERT INTO dossierInputChannelEventSource(id,irn,entrytime) 
    				VALUES (headers[id], :headers[irn], :headers[timestamp])">
    	</int-jdbc:outbound-channel-adapter>
    To make it work, simply change line one to:
    Code:
    <logging-channel-adapter id="dossierInputChannelEventSource"/>
    Why does this work?

  • #2
    Well, when you change line one to be a logging adapter, it's not going to the JDBC adapter at all, right?

    So, have you turned up the logging level to make sure you aren't having a problem in the JDBC adapter itself?

    Comment


    • #3
      Hi!
      So, I see an issue with your INSERT INTO...
      headers[id] doesn't start with colon

      Take care,
      Artem

      Comment


      • #4
        @Mark and Cleric: Thanks. I was mistaken. The code wasn't working when the channel was declared as a logging-channel-adapter. Also, adding the colon before header[id] did not cause the message flow to resume normally.

        I am just now trying to solve a smaller problem. Forget the JDBC adapter (I have commented it out). Why does the following cause messages to not be received on the dossierInputChannel?

        Code:
         	<channel id="dossierInputChannelEventSource"/>
        	
        	<channel id="dossierInputChannel">
        		<queue/>
        		<interceptors>
        	        <wire-tap channel="logHeaderChannel"/>
        	        <wire-tap channel="dossierInputChannelEventSource"/>
        	    </interceptors>
        	</channel>
        Removing the dossierInputChannelEventSource wiretap allows my code to function normally once again.

        Comment


        • #5
          Why does the following cause messages to not be received on the dossierInputChannel?
          I think you mean, that message isn't handled by subscriber to this channel.

          From other side, you mean that two <wire-tap> cause a problem. Right?
          Let us know and we'll investigate it.

          Comment


          • #6
            I think I figured it out. It's because the wire-tap channel must be connected to an endpoint. Attaching an outbound channel adapter to the wire-tap channel in question fixed the problem.

            So I'm guess in regards to my original problem, the JDBC adapter isn't configured properly.

            Comment


            • #7
              My code compiles and messages can get through the system from point A, through B and to C, but the SQL query does not execute. Is there something wrong with my configuration?

              Code:
                	<channel id="dossierInputChannelEventSource">
                		<queue/>
                	</channel>
                	
              	<channel id="dossierInputChannel">
              		<queue/>
              		<interceptors>
              	        <wire-tap channel="logHeaderChannel"/>
              	        <wire-tap channel="dossierInputChannelEventSource"/>
              	    </interceptors>
              	</channel>
              
              	<int-jdbc:outbound-channel-adapter data-source="cacheDataSource"
              		channel="dossierInputChannelEventSource"
              		query="INSERT INTO OTPPRFIL.FOO VALUES(:headers[irn], :headers[dossierEntryKey], :headers[timestamp])">
              		<poller fixed-rate="1000"/>
              		
              	</int-jdbc:outbound-channel-adapter>

              Comment


              • #8
                but my SQL query does not execute.
                1. You had to get an Exception in the logs in this case
                2. Does this INSERT INTO work at all in your DB?
                3. Is there any problem to trevel though the DEBUG JdbcMessageHandler.executeUpdateQuery?

                Comment


                • #9
                  Inserting into my database works when done using Java components. But I need the XML adapter to work in order to implement a clean event source.

                  Is there any problem to trevel though the DEBUG JdbcMessageHandler.executeUpdateQuery?
                  I am getting the following error in my console.

                  Code:
                  [2013-06-07 09:44:38,729] task-scheduler-7 org.springframework.jdbc.core.metadata.TableMetaDataProvider WARN Overriding supportsGetGeneratedKeys from DatabaseMetaData to 'true'; it was reported as 'false' by Apache Derby Embedded JDBC Driver 10.9.1.0 - (1344872)
                  [2013-06-07 09:44:38,755] task-scheduler-8 org.springframework.jdbc.support.SQLErrorCodesFactory INFO SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
                  [2013-06-07 09:44:38,758] task-scheduler-8 org.springframework.integration.handler.LoggingHandler ERROR [Payload=org.springframework.integration.MessageHandlingException: error occurred in message handler [org.springframework.integration.jdbc.JdbcMessageHandler#0]][Headers={timestamp=1370612678758, id=52ec1079-9885-4bee-8253-362b6861adf7, history=errorChannel,errorChannel.adapter}]

                  Comment


                  • #10
                    H-m-m... Strange...
                    I always have in my logs full StackTrace...
                    Is it really a problem to set a break point in the JdbcMessageHandler.executeUpdateQuery and run you application in the debug mode?
                    And show your logging config, please

                    Comment


                    • #11
                      Here is the full stack trace:

                      Code:
                      [2013-06-07 10:27:26,853] task-scheduler-3 org.springframework.beans.factory.xml.XmlBeanDefinitionReader INFO Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
                      [2013-06-07 10:27:26,878] task-scheduler-3 org.springframework.jdbc.support.SQLErrorCodesFactory INFO SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
                      [2013-06-07 10:27:26,891] task-scheduler-3 org.springframework.integration.channel.MessagePublishingErrorHandler ERROR failure occurred in messaging task with message: [Payload={"inputs":{},"output":"$123.45"}][Headers={timestamp=1370615246817, id=305642c5-de4a-49b1-a3bc-41d076ff1a29, history=feederChannel,bufferInputChannel,computerRequestServiceActivatorHandler,computerInputChannel,defaultPenCalcInputChannel,defaultPenCalcServiceActivatorHandler,computerResponseChannel,computerResponseRouterMessageHandler,dossierInputChannel,dossierInputChannelEventSource, correlationId=ca7ab931-5d3a-463e-a5bc-50413e348f94, error=false, sequenceSize=1, event=BUYBACK_ADD, dossierEntryKey=DEFAULT_PEN_CALC, irn=896330576, sequenceNumber=1}]
                      org.springframework.integration.MessageHandlingException: error occurred in message handler [org.springframework.integration.jdbc.JdbcMessageHandler#0]
                      	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:79)
                      	at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
                      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                      	at java.lang.reflect.Method.invoke(Method.java:597)
                      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
                      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
                      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
                      	at org.springframework.integration.monitor.SimpleMessageHandlerMetrics.handleMessage(SimpleMessageHandlerMetrics.java:106)
                      	at org.springframework.integration.monitor.SimpleMessageHandlerMetrics.invoke(SimpleMessageHandlerMetrics.java:86)
                      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
                      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
                      	at com.sun.proxy.$Proxy30.handleMessage(Unknown Source)
                      	at org.springframework.integration.endpoint.PollingConsumer.handleMessage(PollingConsumer.java:74)
                      	at org.springframework.integration.endpoint.AbstractTransactionSynchronizingPollingEndpoint.doPoll(AbstractTransactionSynchronizingPollingEndpoint.java:82)
                      	at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146)
                      	at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:144)
                      	at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:236)
                      	at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)
                      	at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
                      	at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49)
                      	at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:231)
                      	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
                      	at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
                      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
                      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
                      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
                      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
                      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
                      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
                      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
                      	at java.lang.Thread.run(Thread.java:662)
                      Caused by: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO OTPPRFIL.DOSSIERINPUTCHANNELEVENTSOURCE VALUES(?, ?, ?)]; SQL state [XJ001]; error code [0]; Java exception: ': org.apache.derby.iapi.error.ShutdownException'.; nested exception is java.sql.SQLException: Java exception: ': org.apache.derby.iapi.error.ShutdownException'.
                      	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
                      	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
                      	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
                      	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:605)
                      	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:818)
                      	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:840)
                      	at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.update(NamedParameterJdbcTemplate.java:281)
                      	at org.springframework.integration.jdbc.JdbcMessageHandler.executeUpdateQuery(JdbcMessageHandler.java:124)
                      	at org.springframework.integration.jdbc.JdbcMessageHandler.handleMessageInternal(JdbcMessageHandler.java:106)
                      	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
                      	... 30 more
                      Caused by: java.sql.SQLException: Java exception: ': org.apache.derby.iapi.error.ShutdownException'.
                      	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
                      	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
                      	at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
                      	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
                      	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
                      	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
                      	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
                      	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
                      	at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)
                      	at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)
                      	at org.apache.derby.impl.jdbc.EmbedPreparedStatement40.<init>(Unknown Source)
                      	at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown Source)
                      	at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
                      	at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
                      	at org.springframework.jdbc.core.PreparedStatementCreatorFactory$PreparedStatementCreatorImpl.createPreparedStatement(PreparedStatementCreatorFactory.java:245)
                      	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:583)
                      	... 36 more
                      Caused by: java.sql.SQLException: Java exception: ': org.apache.derby.iapi.error.ShutdownException'.
                      	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
                      	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
                      	... 52 more
                      Caused by: org.apache.derby.iapi.error.ShutdownException: 
                      	at org.apache.derby.iapi.services.context.ContextManager.checkInterrupt(Unknown Source)
                      	at org.apache.derby.iapi.services.context.ContextManager.getContext(Unknown Source)
                      	at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.getStatementContext(Unknown Source)
                      	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.doneReading(Unknown Source)
                      	at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
                      	at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
                      	at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
                      	... 45 more
                      [2013-06-07 10:27:27,341] main org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor INFO Shutting down ExecutorService
                      [2013-06-07 10:27:27,342] main org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler INFO Shutting down ExecutorService 'taskScheduler'

                      Comment


                      • #12
                        H-m-m...
                        SQL state [XJ001]; error code [0]; Java exception: ': org.apache.derby.iapi.error.ShutdownException'.
                        Sorry, it's not up to Spring Integration.
                        Try to get help on some Derby forum.
                        Or your DB hasn't started at all

                        Comment

                        Working...
                        X