spring integration 4.1.x channel vs message template send operation - spring-integration

In Spring integration app, you can send message to channel in different ways. Two of them are, you can use channel.send(msg) and MessageTemplate.convertAndSend(channel,msg).
Can anyone tell me the difference and which is recommended? What is the drwaback of others?

There is another more high-level way to send message - #MessagingGateway, where your source client is fully free from Messaging API.
On the other hand it is up to use what to use on the matter.
The MessageChannel.send() API is very low and don't provide so much control over the message.
The MessagingTemplate can be configured as a bean with some common options like MessageConverter, which is really used by the aforementioned convertAndSend(). But in the end it is, of course, just MessageChannel.send().
There is no any recommendations, but MessagingTemplate has been introduced for convenience.

Related

How to make Hubot know he/she is receiving the message in a private chat?

I am creating a Hubot script to do some stuffs. However due to some circumstances, we need to make sure certain commands only works when sent via PM (private message) instead of channels (e.g. telling the bot to save some password).
As a workaround, I am currently using this checker function:
is_private = (res) -> res.message.room == res.message.user.name
We are currently using this with Slack, but need to make the script also works with other adapters as well since we're going to release it as open source project.
Is this method reliable enough? Is there any built-in methods to check this?
In your case, consider use hubot-auth to control permissions for your users
https://www.npmjs.com/package/hubot-auth
or
How to setup Hubot basic permissions?
The Adapter interface is mum on private messages (Campfire, the first adapter, has absolutely no support for PMs). I think your method will work fine for most adapters, but cross-adapter PM behavior is an ongoing issue. Maybe, sometime, I'll get to work on the Adapter interface, but most of my effort is currently focused on the message processing flow.
I'd recommend going with it and keeping an eye out for issues after you release.

Implementing Spring Integration

I have to implement Spring integration, the requirement is that When I get a request I need to split it and call two seperate web services to process the request and then get the response back from both the services and combine it into one and return the response. I am not sure how to just wanted to know if someone had a clue.
And also if this is possible can I make the calls simultaneously
Looks like you don't have enough theoretical knowledges.
You need:
Splitter
Aggregator
Router
Executor Channel
So, please, read these docs:
http://martinfowler.com/books/eip.html
http://www.manning.com/fisher
http://docs.spring.io/spring-integration/docs/2.2.6.RELEASE/reference/html

Pubsubhubbub library for NodeJs

I have a system where various rss feeds are added. I want to follow the content and be notified when new content is added in the feeds without having to check them one by one.
I found out there is a pubsubhubbub protocol and that publishers can use various hubs which implement this protocol in their feeds. This is how I found out about superfeedr and I'm trying to work with their XMPP API. I installed their nodejs library and made a few subscribe tests that worked fine.
Is it possible to use the node superfeedr module to subscribe to a feed that doesn't use superfeedr? For example I found one that has:
link rel='hub' href='http://pubsubhubbub.appspot.com/'
Do I have to handle each hub separately or I can just send them the same requests based on the protocol?
Alex, I created Superfeedr.
Yes, of course it is possible to subscribe to a feed that doesn't use Superfeedr. Superfeedr acts as a default hub. You can add any feed, and you should get notifications for it. The only difference is that you may see delays. We poll feeds every 15 minutes, so, unless there are strong caches, you should see messages no later than 15 minutes after they've been published.
2 and 3 are probably not relevant given 1. However, I believe there are a couple other PubSubHubbub libraries, but they all require that your endpoint is outside the firewall... and all of them will only work for feeds that use the pubsubhubbub protocol. Even though your application will use each hub separately, the code should be the same, so that's transparent for you.
I hope this helps.

Message Passing from Packaged App to Extension

I have seen this article about passing messages between extensions which works when you know the extension ids.
But, what I would really like to do is pass a message from a packaged app to an extension.
I tried to implement the steps in the article above. But i received the message that chrome.extension is not defined.
I assumed this is because it is a packaged app, that it doesnt have chrome.extension.
Is there a way to do this?
Thanks
AH
You should be able to accomplish via Web Intents, specifically the "explicit" variant that can be targeted at a specific app/extension. See this sample in the apps repository for two apps that communicate via explicit Web Intents (the same concept can be applied to an extension and an app, except the extension would receive intents via a URL specified in the manifest).
Cross-extension messaging
In addition to sending messages between different components in your
extension, you can use the messaging API to communicate with other
extensions. This lets you expose a public API that other extensions
can take advantage of.
Listening for incoming requests and connections is similar to the
internal case, except you use the runtime.onMessageExternal or
runtime.onConnectExternal methods.
http://developer.chrome.com/dev/extensions/messaging.html

Simple sip based client interaction... Any Ideas

I am tring to do the following:
I want a SIP User Agent to perform the following steps on receiving an inbound call (call set up request).
1) Read the caller ID from the SIP request and Log the details to file
2) Drop the call (terminate the call without picking up the call)
I have not been able to find a high level api that will let me script this interaction. I have taken a look at Jain but it seems to be a very low level API and I imagine will require a lot of work to get the above interaction coded up and working. Can anyone suggest an apropriate API to implement the above.
NOTE: I have tried ROXEO.com and their CCXML based apps are great but their pricing is aimed at big companies, so Voxeo is not an option.
There are quite a few open source SIP stacks around two examples of many are pjsip and sipsorcery (as a disclaimer I do some dev work on the latter). It will all depend on your language and prefeences as to which one suits. There are also lots of SIP tools around that may be a more efficient approach for you such as SIPp.
Apart from those options and given your very simple requirements you could probably get away with 20 or 30 lines of code that listens on a UDP socket, parses the incoming INVITE to extract the From header and then sends back a rejection response by changing the top line of the request to make it a response and sending it back to where it came from.
If you're using C, try eXosip, you could easily whatever you want.
Here
It's clear that Jain SIP could be quite painful (actually all the configuration but the API otherwise is quite high-level, to manipulate messages) , but you can take the jain-sip-presence-proxy and removes almost everything from their INVITE handler and build your own message
if you're using java, you can use peers which provides a high level api in package net.sourceforge.peers.sip.core.useragent. The entry point is UserAgent class, take a look at gui package if you want to see how it is used. Traces are in log files so you can track calls.
ivrworx but it can handle one scenarion at a time only
Asterisk pbx can act as a simple sip client, and do just that, however if you wante to integrate something in your own solution, take a look at: http://sipsimpleclient.org/projects/sipsimpleclient/wiki/SipMiddlewareApi

Resources