Time Limit issue in mod_multicast ejabberd - multicast

We are using mod_multicast with ejabberd 2.1.11 with the following configuration
[{host, "multicast.server_ip"},
{access, multicast},
{limits,
[{local, message, infinite},
{local, presence, infinite},
{remote, message, infinite}]}]
but we are getting this error in response when we send a second broadcast message after two three seconds of first message,
<message xmlns="jabber:client" from="multicast.server_ip" to="8_9414440765#server_ip/10909448101435316508474960" type="error" id="1435316983">
<addresses xmlns="http://jabber.org/protocol/address">
<address type="to" desc="1435316983" jid="10_9414756966#server_ip"/>
<address type="cc" desc="1435316983" jid="9_8386837120#server_ip"/>
</addresses><ftype>emoji</ftype>
<body>[FG#007]</body>
<broadcastid>6</broadcastid>
<error code="403" type="auth">
<forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
Packet relay is denied by service policy</text></error></message>
When we are sending a message after some time, it goes well.

ejabberd 2.1.11 is more than 3 years old and is not supported anymore. My suggestion for first step is to switch to a more up to date ejabberd, like ejabberd 15.06.

Related

JMS Message body is null when publishing with jms:publish-subscribe-channel

I am trying to use jms:publish-subscribe-channel to pub/sub on a single ActiveMQ topic. I am able to receive messages from ActiveMQ on the channel just fine, however when I publish to the channel the message body is null (when received by another application listening on the ActiveMQ topic). I was able to recreate the problem using spring-integration-samples->basic->jms. I modified outboundChannelAdapter.xml to use jms:publish-subscribe-channel instead of jms:outbound-channel-adapter. Is there another step needed in order to publish a simple string message? Here's my code change to outboundChannelAdapter.xml:
<stream:stdin-channel-adapter id="stdin" channel="stdinToJmsoutChannel"/>
<jms:publish-subscribe-channel id="stdinToJmsoutChannel" topic="requestTopic" />
<stream:stdout-channel-adapter id="stdout" channel="stdinToJmsoutChannel" append-newline="true"/>
I am not sure what you mean by "the message body is null".
I just made the exact same change to the sample and it worked fine for me...
Please type something and hit <enter>
foo
foo
I had to add -Dorg.apache.activemq.SERIALIZABLE_PACKAGES=* to the command line because activemq needs whitelisting for classes (the whole message is serialized in jms-backed channels).

Http Inbound Gateway takes 2x timeout to send timeout response to client

We're using an http inbound gateway to process http requests. Lately , we wanted to set specific http response code that will be sent to user after a timeout.
We upgraded to spring 4.2.1 and set
the reply-timeout-status-code-expression attribute
and it's working now.
But there is a problem : if we set the timeout to 10 seconds , a ReplyTimeoutException is raised in the web application after exactly 10 seconds but the response arrives to the client after 20 seconds ( exactly the double ).
We changed the timeout several times but it always take 2x timeout for the response to be received by client.
This is the xml config for the http inbound gateway :
<int-http:inbound-gateway id="inboundRequest" request-channel="inbound-channel"
supported-methods="POST" path="/Request" error-channel="errorChannel" reply-channel="gateway_response"
reply-timeout="5000" request-payload-type="java.lang.String" reply-timeout-status-code-expression="'504'" >
A Help would be really appreciated
I see you have an error-channel - if the error flow returns no response, the reply timer starts again when the error flow ends (we're waiting for a reply from the error flow).
Instead of returning nothing from the error flow, you need to throw a MessageTimeoutException.
Turning on DEBUG logging and following the message flow is the best way to diagnose issues like this.
If that's not the problem, you need to show the rest of your configuration (edit the question, don't try to post it in a comment).

Bad messages handling with jms:message-driven-channel-adapter

I see one issue today.I have few messages dropped in a queue and one message is throwing error in service activator. the errorred message keep on trying again and again without other messages are processing from a queue. Is there any way I can set in below config to send error msg to end of queue messages. (ex if queue depth is 1000, error msg will be at 1000 pos)
<jms:message-driven-channel-adapter id="exch" destination="requestQueue" channel="jmsInChannel"
transaction-manager="txManager" acknowledge="auto" concurrent-consumers="3"/>
<int:service-activator input-channel="jmsInChannel" ref="messageService"/>
Pls advice.
thanks Gary..Unfortunately we can't change any MQ configuration.
I have tried as follows and going to add service activator for errorRetryChannel.
<int:service-activator input-channel="jmsInChannel" ref="messageService">
<int:request-handler-advice-chain>
<int:retry-advice max-attempts="4" recovery-channel="errorRetryChannel">
<int:exponential-back-off initial="1000" multiplier="5.0" maximum="60000" />
</int:retry-advice>
</int:request-handler-advice-chain>
</int:service-activator>
Typically, you would configure the broker to dump "poison" messages to a dead letter queue after some number of attempts.
If you can't do that, you can add a retry advice to your service activator together with a recoverer that can log and otherwise dispose of the bad message.
A custom recoverer could requeue the message at the tail of the queue but you will probably want to trash irrecoverable messages.

Is there an API in spring-xd to write to a message bus?

Considering any message bus can be deployed with spring-xd, is there any API provided by spring-xd that can write to the message bus deployed, say, Kafka/rabbitmq based on the configurations in xd/config/servers.yml or any other such place.
I am writing a processor (itemprocessor), which does some processing of the data and the writer will write the data to a rabbitmq queue for now. Since, in the current deployment scenario, rabbitmq may or may not be deployed, the processor should be able to write to the default Redis message bus.I know I can write to rabbitmq using apis provided by spring-rabbit, but that will tie my processor to RabbitMQ. I am looking for a way to generalize it. I tried to looked into spring-xd code to see if there were any examples like this. I found a MessageProcessor example, but this one is a stream processor, not sure how I can apply it or if I am on the right track.
https://github.com/spring-projects/spring-xd/blob/master/spring-xd-rxjava/src/test/java/org/springframework/xd/rxjava/PongMessageProcessor.java
I just started working with spring-xd, so please pardon my ignorance if this has already been discussed. Any pointers are greatly appreciated.
Update
Thanks Gary, based on your answer I tried out the spring-integration jms samples.
I have a spring batch job which has
<batch:chunk reader="reader" processor="processor" writer="writer" />
I want the output of the writer to be written to any underlying message bus, RabiitMQ to start with. So I added the following, based on what I saw in the examples:
<beans:bean id="writer" class="abc" scope="step">
</beans:bean>
<channel id="outputme"/>
<beans:bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue">
<beans:constructor-arg value="queue.demo"/>
</beans:bean>
<beans:bean id="replyQueue" class="org.apache.activemq.command.ActiveMQQueue">
<beans:constructor-arg value="queue.reply"/>
</beans:bean>
<jms:outbound-gateway request-channel="outputme"
request-destination="requestQueue"
reply-channel="jmsReplyChannel"/>
<channel id="jmsReplyChannel" />
<beans:beans profile="default">
<stream:stdout-channel-adapter channel="jmsReplyChannel" append-newline="true"/>
</beans:beans>
When I execute this, I see the following output, which leads me to believe that something is getting written to the embedded ActiveMQ broker.
16:05:42,400 [AbstractApplicationContext] - Closing org.springframework.context.support.GenericApplicationContext#125a6d70: startup date [Tue Feb 03 16:05:40 PST 2015]; root of context hierarchy
16:05:42,401 [DefaultLifecycleProcessor$LifecycleGroup] - Stopping beans in phase 0
16:05:42,402 [EventDrivenConsumer] - Removing {jms:outbound-gateway} as a subscriber to the 'outputme' channel
16:05:42,402 [AbstractSubscribableChannel] - Channel 'org.springframework.context.support.GenericApplicationContext#125a6d70.outputme' has 0 subscriber(s).
16:05:42,402 [AbstractEndpoint] - stopped org.springframework.integration.config.ConsumerEndpointFactoryBean#0
16:05:42,402 [EventDrivenConsumer] - Removing {service-activator} as a subscriber to the 'jmsReplyChannel' channel
16:05:42,402 [AbstractSubscribableChannel] - Channel 'org.springframework.context.support.GenericApplicationContext#125a6d70.jmsReplyChannel' has 1 subscriber(s).
16:05:42,402 [AbstractEndpoint] - stopped org.springframework.integration.config.ConsumerEndpointFactoryBean#1
16:05:42,402 [EventDrivenConsumer] - Removing {stream:outbound-channel-adapter(character)} as a subscriber to the 'jmsReplyChannel' channel
16:05:42,403 [AbstractSubscribableChannel] - Channel 'org.springframework.context.support.GenericApplicationContext#125a6d70.jmsReplyChannel' has 0 subscriber(s).
16:05:42,403 [AbstractEndpoint] - stopped org.springframework.integration.config.ConsumerEndpointFactoryBean#2
However, when I try to change ActiveMQ with RabbitMQ by changing the connectionfactory like this:
<rabbit:connection-factory id="connectionFactory" />
I get an error saying:
Cannot convert value of type [org.springframework.amqp.rabbit.connection.CachingConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory'
which I understand based on what is mentioned in the schema file at http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd, as the required type is javax.jms.ConnectionFactory for the element connection-factory. I looked around, did not find a way to create the conenctionFactory for RabbitMQ the same way as we create the ConnectionFactory for ActiveMQ.
I looked around and am not sure how to fix this. Maybe I am missing something very basic. I am not even sure if this is the right approach. Can you please let me know what I am missing and if this is the right approach? I apologize in advance if this has been discussed already.
Thank you again for your time.
Thank you so much for your time.
regards,
Alice
The MessageBus SPI is very specific for XD intra-module commmunication; it's not designed for arbitrary application-level messaging.
That said, XD (and its message bus implementations) uses the Spring Integration project extensively.
That project provides the abstraction you need. You can send to a message channel (either using a MessagingGateway or a MessagingTemplate and, downstream of that channel, you can wire in any kind of channel adapter (rabbit [amqp], redis, etc).
So your item processor is decoupled from the actual technology that receives the message.
Take a look at the Spring Integration reference manual (there's a link on the project page).

Intermittent BridgeHandler & PublishSubscribeChannel call when gateways' reply channel is pub/sub

I'm seeing weird behaviour when sending data through my channels. I'm using SI gateway when sending a message to be processed. The gateway is setup as below
<integration:gateway id="rptPubGateway"
default-request-channel="rptPubInChannel"
default-reply-channel="rptOutputAvailableChannel"
default-reply-timeout="60000"
service-interface="xxxx.RptPubGateway" />
The reply channel is being set up as a publish/subscribe channel
<integration:publish-subscribe-channel id="rptOutputAvailableChannel" />
The last service that processes the message is being declared as below
<integration:service-activator input-channel="rptOutputAvailableChannel" ref="requestMessageHandler" method="rptIsDone" output-channel="nullChannel"/>
Now, the issue that i have is that while the code works fine most of the time, it fails sometimes. When everything works fine the last component processing my message is PublishSubsChannel
PublishSubscribeChannel - preSend on channel 'rptOutputAvailableChannel'
but when it fails the last component becomes BridgerHandler
BridgeHandler#e851a798' sending reply Message:
I should mention that there are no exceptions being thrown while processing my message. (after the failure I can always resend the same message and everything will work OK)
I'm not sure how that BridgerHandler gets created. From what I know this bridge gets created for pub/subs channels but then why I don't see it in the log when everything works fine ?
I'd appreciate any help
When you say "fails" what do you mean?
What are the other consumers on rptOutputAvailableChannel?
The BridgeHandler you see is an internal bridge to the message's replyChannel header, which is where the reply ultimately must go. When explicitly sending to rptOutputAvailableChannel, the bridge handler is always invoked to get the reply to the message's temporary reply channel.

Resources