Camel Component: Is it possible to create a Consumer Only Component? - apache-camel

I have a dilemma.
I have a GET based REST service and a POST based REST service.
I have to create custom Camel Components for each of these.
Can we create a Camel Component that only consumes?
Similarly, is it possible to create a custom Camel Component that produces only?
If a Camel Component only consumes, how do we provide messages to it for consumption? Because if we write to("consumeOnly:someURI"), this makes this component, a Producer. And createProducer() of the consumeOnly Endpoint will be invoked?

Yeah when implement a custom Camel component then in the createConsumer / createProducer methods just throw an exception saying this component does not support consumer or producer.
That is how the components from Apache Camel itself does it. Its for historical reasons that an exception is thrown instead of having maybe a different api for either one.

Related

Is it oaky to use React Context alongside with Redux Provider?

I am building a simple real time messaging app using react and socket.io for practice.
Current solution uses React's Context only to store socket.io object and React-Redux to store the rest.
The reason that I'm using the context alongside the redux is because redux cries for the following error when I try to store socket.io object into its state.
I also thought of using an exported socket.io module instead of the Context:
import io from "socket.io-client";
const socket = io(URL);
socket.connect();
export socket;
but did read some thread saying that it is not a great practice of using React ecosystem.
Any inputs, please?
It is absolutely fine to use Redux for state management and Context for dependency injection like you are doing here.
That's exactly what each of these were made for.
I am also working on a real-time chat widget project here in my company, and one thing I will suggest you is, while using react, it is all up to you what are you using and where because react is a library. but keeping one thing in mind your components must be scalable. I made my widget using svelte and managed the Web Sockets using event handlers.
you should give it a try.
one file with all the socket code and event listeners attached to them
2nd file with the custom events written which will invoke the socket operations from 1st file.

Loading dynamic layout in react from a remote API response

How do I setup my react components in order to get the layout loaded from a remote rest based API? (I want the layout to be stored in a db so that it may be changed by the user whenever needed)
The API is a dot net core based API. It might be slightly difficult doing server side rendering. (Although that may be considered as well if there are no other options)
I essentially want to know if there is a way to send the jsx from the API. Is there then a way to return this jsx that I have received as the response from my component.

Fetch resource manually [GraphQL]

Can you tell me what would be the best way to get a resource manually in custom component?
I'm using the simple GraphQL client for admin-on-rest.
aor-simple-graphql-client has been deprecated. Note that aor-graphql-client is meant to be used for admin-on-rest requests. If you need to send your own queries, you should use a custom ApolloClient and follow their documentation

EventBus in React / Redux Applications

I am new to react and wondering what the best way to have decoupled communication in a modular React based application. Actually my issue is a plain old JavaScript abstraction over a restful API that is consumed by a React application.
I have a need to notify a consumer of the API abstraction that something has happened (session has timed out on the server as it happens).
Ordinarily I would use pub sub / an event bus.
I have considered adding another shared redux layer but that still couples everything together though delegates the coupling into the shared module which I guess is a mediator.
I can't find much about this online.
Anyone got thoughts on this?
Thanks
You could use Redux Saga/ Thunk for the above purpose

How can I get access to the InOut behaviour in a Custom Camel Component (Apollo)

I am busy developing a Camel Component for Apollo using the HawtDispatch Apollo Client library for Scala.
I am successful with sending and receiving of messages from queues and topics but I do not know how I can determine that the current producer (StompProducer) requires inOut or InOnly behaviour. For InOut I want to subscribe to a temporary queue to get the result if no explicit replyTo is provided.
Am I barking up the wrong tree? Are there any examples I can look at? Has somebody already done an Apollo Stomp Component?
I have tried using the ActiveMQ component to bind to the OpenWire protocol in Apollo 1.5 but that did not work well. The Sjms Camel component in Camel 2.11-SNAPSHOT also did not work for me.
The end goal is to have Apollo Consumer/Producers Actors for Akka.
Any advice on alternatives for Camel Apollo integration or on getting my own attempt at a Component working, will be much appreciated.
Regards
Ian
Found the answer: when processing an exchange you can test if is an inOut exchange by using exchange.getPattern.isOutCapable.

Resources