RTMPS , implementation not getting hit from client side - java

I m trying to implement rtmps on my red5 server. i have added the certificates i.e imported them to a key store and have uploaded them on the server. have enabled rtmps part on red5-core.xml .. This much part i.e
<!-- RTMPS -->
<bean id="rtmpsMinaIoHandler"
class="org.red5.server.net.rtmps.RTMPSMinaIoHandler">
<property name="handler" ref="rtmpHandler" />
<property name="codecFactory" ref="rtmpCodecFactory" />
<property name="rtmpConnManager" ref="rtmpMinaConnManager" />
<property name="keyStorePassword" value="${rtmps.keystorepass}" />
<property name="keystoreFile" value="conf/keystore" />
</bean>
<bean id="rtmpsTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
<property name="ioHandler" ref="rtmpsMinaIoHandler" />
<property name="connectors">
<list>
<bean class="java.net.InetSocketAddress">
<constructor-arg index="0" type="java.lang.String" value="${rtmps.host}" />
<constructor-arg index="1" type="int" value="${rtmps.port}" />
</bean>
</list>
</property>
<property name="connectionThreads" value="${rtmp.connect_threads}" />
<property name="ioThreads" value="${rtmp.io_threads}" />
<property name="receiveBufferSize" value="${rtmp.receive_buffer_size}" />
<property name="sendBufferSize" value="${rtmp.send_buffer_size}" />
<!-- This is the interval at which the sessions are polled for stats. If mina monitoring is not
enabled, polling will not occur. -->
<property name="jmxPollInterval" value="1000" />
<property name="tcpNoDelay" value="${rtmp.tcp_nodelay}" />
</bean>
The problem is when i try to hit my server with
rtmps://mysite:8443/red5server
I dont get a hit on my server. If as rtmps is not running at all. Any help or tutorial on configuring rtmps will be a grat help.

Related

jasig cas server with multple Ldap servers and Database authentication

I configured jasig CAS server with multiple ldap servers and DB authentication.
My order of authentication is ldap1-->ldap2-->DataBase. Accidentally ldap1 server was down due to some reason. As a result none of the users are able to login into the application.
Please advice how to handle this cases.
Cas server version 3.6.0
This is the configuration of deployerConfigContext.xml
<bean class="org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler"
p:filter="sAMAccountName=%u"
p:searchBase="*.*"
p:contextSource-ref="contextSource"
p:ignorePartialResultException="true" >
<property name="ldapErrorDefinitions">
<list>
<bean class="org.jasig.cas.adaptors.ldap.LdapErrorDefinition"
p:ldapPattern="data 530"
p:type="badHours" />
<bean class="org.jasig.cas.adaptors.ldap.LdapErrorDefinition"
p:ldapPattern="data 533"
p:type="accountDisabled" />
<bean class="org.jasig.cas.adaptors.ldap.LdapErrorDefinition"
p:ldapPattern="data 773"
p:type="mustChangePassword" />
<bean class="org.jasig.cas.adaptors.ldap.LdapErrorDefinition"
p:ldapPattern="data 775"
p:type="accountLocked" />
<bean class="org.jasig.cas.adaptors.ldap.LdapErrorDefinition"
p:ldapPattern="data 531"
p:type="badWorkstation" />
<bean class="org.jasig.cas.adaptors.ldap.LdapErrorDefinition"
p:ldapPattern="data (701|532)"
p:type="passwordExpired" />
</list>
</property>
</bean>
<bean class="org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler"
p:filter="sAMAccountName=%u"
p:searchBase="*.*"
p:contextSource-ref="contextSource1"
p:ignorePartialResultException="true" >
<property name="ldapErrorDefinitions">
<list>
<bean class="org.jasig.cas.adaptors.ldap.LdapErrorDefinition"
p:ldapPattern="data 530"
p:type="badHours" />
<bean class="org.jasig.cas.adaptors.ldap.LdapErrorDefinition"
p:ldapPattern="data 533"
p:type="accountDisabled" />
<bean class="org.jasig.cas.adaptors.ldap.LdapErrorDefinition"
p:ldapPattern="data 773"
p:type="mustChangePassword" />
<bean class="org.jasig.cas.adaptors.ldap.LdapErrorDefinition"
p:ldapPattern="data 775"
p:type="accountLocked" />
<bean class="org.jasig.cas.adaptors.ldap.LdapErrorDefinition"
p:ldapPattern="data 531"
p:type="badWorkstation" />
<bean class="org.jasig.cas.adaptors.ldap.LdapErrorDefinition"
p:ldapPattern="data (701|532)"
p:type="passwordExpired" />
</list>
</property>
</bean>
<!-- This AuthenticationHandlers for Database -->
<bean class="com.ls.authentication.DBAuthenticationHandler">
<property name="dataSource" ref="dataSource" />
<property name="sql" value="${dbCredentialSql}" />
</bean>
<bean id="contextSource1" class="org.springframework.ldap.core.support.LdapContextSource">
<!-- DO NOT enable JNDI pooling for context sources that perform LDAP bind operations. -->
<property name="pooled" value="false"/>
<property name="url" value="ldap://x.x.x.x" /> <!-- AD ip address or url -->
<property name="userDn" value="*.*"/> <!-- username exist in AD -->
<property name="password" value="*.*"/> <!-- password of user in AD -->
<!-- Place JNDI environment properties here. -->
<property name="baseEnvironmentProperties">
<map>
<!-- Three seconds is an eternity to users. -->
<entry key="com.sun.jndi.ldap.connect.timeout" value="30000" />
<entry key="com.sun.jndi.ldap.read.timeout" value="30000" />
<!-- Explained at http://docs.oracle.com/javase/jndi/tutorial/ldap/security/auth.html -->
<entry key="java.naming.security.authentication" value="simple" />
</map>
</property>
</bean>
<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
<!-- DO NOT enable JNDI pooling for context sources that perform LDAP bind operations. -->
<property name="pooled" value="false"/>
<property name="url" value="ldap://x.x.x." /> <!-- AD ip address or url -->
<property name="userDn" value="*******"/> <!-- username exist in AD -->
<property name="password" value="******"/> <!-- password of user in AD -->
<property name="baseEnvironmentProperties">
<map>
<!-- Three seconds is an eternity to users. -->
<entry key="com.sun.jndi.ldap.connect.timeout" value="30000" />
<entry key="com.sun.jndi.ldap.read.timeout" value="30000" />
<!-- Explained at http://docs.oracle.com/javase/jndi/tutorial/ldap/security/auth.html -->
<entry key="java.naming.security.authentication" value="simple" />
</map>
</property>
</bean>

Camel creating too many tcp connections (over 15000) in TIME_WAIT status to connect ActiveMQ

I am using Apache Camel(with Spring) and ActiveMQ in project. Here are the settings related to JMS/ActiveMQ:
Camel version: activemq-camel-5.15.3.jar (all ActiveMQ related jars)
ActiveMQ version : 5.15.0
<!-- language: lang-xml -->
<bean id="defaultActiveMQRedeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
</bean>
<util:list id="redeliveryPolicyEntries">
<bean id="activeMQRedeliveryPolicy1" class="org.apache.activemq.RedeliveryPolicy">
<property name="queue" value="inbox"></property>
</bean>
</util:list>
<bean id="amqRedeliveryPolicyMap"
class="org.apache.activemq.broker.region.policy.RedeliveryPolicyMap">
<property name="defaultEntry" ref="defaultActiveMQRedeliveryPolicy"></property>
<property name="redeliveryPolicyEntries" ref="redeliveryPolicyEntries"></property>
</bean>
<bean id="amqPrefetchPolicy" class="org.apache.activemq.ActiveMQPrefetchPolicy">
</bean>
<bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
<property name="maxConnections" value="20" />
<property name="maximumActiveSessionPerConnection" value="40" />
<property name="connectionFactory" ref="jmsConnectionFactory">
</property>
</bean>
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${jmsConnectionFactory.brokerURL}" />
<property name="userName" value="admin" />
<property name="password" value="admin" />
<property name="prefetchPolicy" ref="amqPrefetchPolicy" />
<property name="redeliveryPolicyMap" ref="amqRedeliveryPolicyMap" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory" />
<property name="concurrentConsumers" value="15" />
<property name="maxConcurrentConsumers" value="30" />
<property name="asyncConsumer" value="false" />
<property name="cacheLevelName" value="CACHE_CONSUMER" />
</bean>
<!-- this bean actually represents a jms component to be used in our camel-integration
setup.make endpoints by using name(id) of this bean. -->
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig" />
<property name="transacted" value="false" />
<property name="transactionManager">
<bean class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
</property>
</bean>
As you see I am using PooledConnectionFactory so I am expecting a fixed no of connections to connect with ActiveMQ. But unexpectedly I see a large no of TCP connections being opened in TIME_WAIT even when my application is idle and no messages are being produced/consumed at time. I confirmed this situation with infra team that confirmed all the Operating System level configuration are fine.
Here I tried debugging the doReceiveAndExecute method in AbstractPollingMessageListenerContainer- sessionToUse is not null, consumerToUse is also not null and code flows through receiveMessage(line number 304).I could not find the problem in debug trace as attached in debug screenshots:
and
and my actual problem
Is it a problem with MessageListenerContainer or with ConnectionFactory?? Am I missing some configuration which would prevent this from happening or is this an existing issue? If so is there a workaround?
Just spotted in your configuration that you configured the jmsConnectionFactory (not the pooled factory) in your transaction manager. Not sure if this could raise the issue because the pooled factory is simply not used.
<property name="transactionManager">
<bean class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
</property>

Camel/ActiveMQ Transactions, Redelivery and DLQs

Using Fabric8 379 build.
Currently struggling with ActiveMQ & Camel getting the desired behaviours of TransactionErrorHandler to work as expected.
Firstly as per the Camel error handler documentation (http://camel.apache.org/error-handler.html) if I invoke the TransactionErrorHandler as suggested i.e.
<errorHandler id="txEH" type="TransactionErrorHandler">
<redeliveryPolicy logStackTrace="false" logExhausted="false" maximumRedeliveries="3"/>
</errorHandler>
I get an error:
Caused by: org.xml.sax.SAXParseException: cvc-enumeration-valid: Value 'TransactionErrorHandler' is not facet-valid with respect to enumeration '[DeadLetterChannel, DefaultErrorHandler, NoErrorHandler, LoggingErrorHandler]'. It must be a value from the enumeration.
Which is fair enough, I guess TransactionErrorHandler has been removed from the schema and has to be invoked differently? So if I go the alternative route and specify a TransactionErrorHandler bean like so:
<bean id="transactionErrorHandler"
class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder">
<property name="deadLetterUri" value="activemq:queue:ActiveMQ.DLQ" />
<property name="redeliveryPolicy" ref="redeliveryPolicy" />
</bean>
<bean id="redeliveryPolicy" class="org.apache.camel.processor.RedeliveryPolicy">
<property name="backOffMultiplier" value="2" />
<property name="maximumRedeliveries" value="2" />
<property name="redeliveryDelay" value="1000" />
<property name="useExponentialBackOff" value="true" />
</bean>
I can successfully use this within my route by specifying errorHandlerRef="transactionErrorHandler". However when testing this scenario, the redeliveryPolicy is completely ignored, with redelivery attempts being 6 (default) rather than the 2 specified above. I am hoping someone can point me in the right direction around how to properly specify a TransactionErrorHandler within a route. Below is my current test blueprint.xml, which is deployed onto a fabric:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd">
<!-- blueprint property placeholders -->
<cm:property-placeholder id="test-adapter" persistent-id="uk.test.transactions">
<cm:default-properties>
<cm:property name="amqBrokerURL" value="discovery:(fabric:platform)" />
<cm:property name="amqBrokerUserName" value="admin" />
<cm:property name="amqBrokerPassword" value="admin" />
</cm:default-properties>
</cm:property-placeholder>
<camelContext xmlns="http://camel.apache.org/schema/blueprint" id="TestRouteContext" useMDCLogging="true">
<!-- <errorHandler id="txEH" type="TransactionErrorHandler">
<redeliveryPolicy logStackTrace="false"
logExhausted="false" />
</errorHandler> -->
<route id="platform-test-route" errorHandlerRef="txEH">
<from uri="activemq:queue:test-queue-in" />
<transacted ref="transactionPolicy" />
<!-- Basic Bean that logs a message -->
<bean ref="stubSuccess" />
<!-- Basic Bean that throws a java.lang.Exception-->
<bean ref="stubFailure" />
<to uri="activemq:queue:test-queue-out" />
</route>
</camelContext>
<bean id="stubSuccess" class="uk.test.transactions.stubs.StubSuccess" />
<bean id="stubFailure" class="uk.test.transactions.stubs.StubFailure" />
<bean id="transactionErrorHandler"
class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder">
<property name="deadLetterUri" value="activemq:queue:ActiveMQ.DLQ" />
<property name="redeliveryPolicy" ref="redeliveryPolicy" />
</bean>
<bean id="transactionPolicy" class="org.apache.camel.spring.spi.SpringTransactionPolicy">
<property name="transactionManager" ref="jmsTransactionManager" />
<property name="propagationBehaviorName" value="PROPAGATION_REQUIRED" />
</bean>
<bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="jmsPooledConnectionFactory" />
</bean>
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="connectionFactory" ref="jmsPooledConnectionFactory" />
<property name="transacted" value="true" />
<property name="transactionManager" ref="jmsTransactionManager" />
<property name="cacheLevelName" value="CACHE_CONSUMER" />
</bean>
<bean id="jmsPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory"
init-method="start" destroy-method="stop">
<property name="maxConnections" value="1" />
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<!-- <bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
<property name="backOffMultiplier" value="2" />
<property name="initialRedeliveryDelay" value="2000" />
<property name="maximumRedeliveries" value="2" />
<property name="redeliveryDelay" value="1000" />
<property name="useExponentialBackOff" value="true" />
</bean> -->
<bean id="redeliveryPolicy" class="org.apache.camel.processor.RedeliveryPolicy">
<property name="backOffMultiplier" value="2" />
<property name="maximumRedeliveries" value="2" />
<property name="redeliveryDelay" value="1000" />
<property name="useExponentialBackOff" value="true" />
</bean>
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${amqBrokerURL}" />
<property name="userName" value="${amqBrokerUserName}" />
<property name="password" value="${amqBrokerPassword}" />
<property name="watchTopicAdvisories" value="false" />
<!-- <property name="redeliveryPolicy" ref="redeliveryPolicy" /> -->
</bean>
</blueprint>
If anyone could see where I am going wrong it would be much appreciated.
You should configure the redelivery options on the AMQ broker as when you use TX, its the brokers responsible for doing the redelivery (not Camel).

How to handle Spring Webservice connection error in the start up?

I'm using JaxWsPortProxyFactoryBean in Spring to connect a SOAP webservice. The problem is that if in the moment of Spring start up the webservice is down (because of network problem). It will cause an Exception and stop the Spring initialization. I don't want this behavior, the application doesn't need to stop only because of a failure with a webservice connection.
Is there any better/correct way using Spring to deal with this problem ?
Here is my current xml context.
<bean id="beanWebServiceSOAP" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean" lazy-init="true">
<property name="serviceInterface" value="com.company.bean.BeanWebServiceSoap" />
<property name="wsdlDocumentUrl" value="${bean.wsdldocumenturl}" />
<property name="namespaceUri" value="${bean.namespaceuri}" />
<property name="serviceName" value="BeanWebService" />
<property name="portName" value="BeanWebServiceSoap" />
</bean>
Thanks,
Maybe by setting the property 'lookupServiceOnStartup' to false:
<bean id="beanWebServiceSOAP" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean" lazy-init="true">
<property name="serviceInterface" value="com.company.bean.BeanWebServiceSoap" />
<property name="wsdlDocumentUrl" value="${bean.wsdldocumenturl}" />
<property name="namespaceUri" value="${bean.namespaceuri}" />
<property name="serviceName" value="BeanWebService" />
<property name="portName" value="BeanWebServiceSoap" />
<property name="lookupServiceOnStartup" value="false" />
</bean>

How to set up a dead letter queue for each durableTopic?

I have set up an application to listen to an ActiveMQ topic. Here's the way I have configured it:
<jms:listener-container connection-factory="jmsFactory"
container-type="default" destination-type="durableTopic" client-id="CMY-LISTENER"
acknowledge="transacted">
<jms:listener destination="CMY.UPDATES"
ref="continuingStudiesCourseUpdateListener" subscription="CMY-LISTENER" />
</jms:listener-container>
<bean id="jmsFactoryDelegate" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${jmsFactory.brokerURL}" />
<property name="redeliveryPolicy">
<bean class="org.apache.activemq.RedeliveryPolicy">
<property name="maximumRedeliveries" value="10" />
<property name="initialRedeliveryDelay" value="60000" />
<property name="redeliveryDelay" value="60000" />
<property name="useExponentialBackOff" value="true" />
<property name="backOffMultiplier" value="2" />
</bean>
</property>
</bean>
How do I set up a dead letter queue for each topic for those messages to get copied into when they reach the maximum deliveries?
This feature went into the most recent 5.5 release, you can find the info on the changes that were made here:
There's a new boolean attribute 'destinationPerDurableSubscriber' on IndividualDeadLetterStrategy in you activemq.xml

Categories

Resources