Ignore new incoming files started route apache camel - apache-camel

How can I ignore new incoming files if my route is already started with aws2-s3 component ? (Files added after starting the route)

Related

How to configure asp.net core to return react front end and work with react-router?

I would like my backend to serve up my front end (which is written in react). I added the following cade to program.cs:
var frontEndBuildDirectory = "Path to front end build directory";
app.UseFileServer(new FileServerOptions()
{
FileProvider = new PhysicalFileProvider(frontEndBuildDirectory ),
RequestPath = ""
});
My understanding is that this code does two things:
If a request's url starts with the host name of my backend (localhost:xyzw), everything following the host name will be a virtual path into frontEndBuildDirectory.
When a request is made into frontEndBuildDirectory (the directory itself, not a file within the directory), then the response is the index.html file within frontEndBuildDirectory.
The problem is that my react code uses the react-router library. If I make a request to the backend (localhost:xyzw), the front end is served. Then when I click on something that changes the route (using react router), the url changes to localhost:xyzw/route1 and the everything works. However, if I try to search up localhost:xyzw/route1, I get a page not found error.
My understanding is that this happens because there is no file named route1 in frontEndBuildDirectory.
What is the proper way to make requests like localhost:xyzw/route1 not give a page not found error?

How to add loadbalancing for http4 component in apache camel. For http4 component code check below

For http4 component code check below.
rules.getRules().forEach(x->{
from("jetty:http://0.0.0.0:"+rules.getPort()+"/"+x.getFrom()+"??matchOnUriPrefix=true")
.to("http4://"+x.getTo()+"?bridgeEndpoint=true&throwExceptionOnFailure=false");
System.out.println(“Ieration Route: ”+x);});
Please check the sample routing below(X value)
Ieration Route: {"RouteRule":{ "from":"posts", "to":"jsonplaceholder.typicode.com/posts/?"}}
Ieration Route: {"RouteRule":{ "from":"users", "to":"reqres.in/api/users"}}
Ieration Route: {"RouteRule":{ "from":"countries", "to":"restcountries.eu/rest/v2/"}}
Application.yml file
routes:
port: 8088
route:
-
from: posts
to: jsonplaceholder.typicode.com/posts/?
-
from: users
to: reqres.in/api/users
-
from: countries
to: restcountries.eu/rest/v2/
Where we can add multiple servers in above scenario? in yml file configuration if yes how we can add that.
Appreciated your help.
Thanks
As per the camel doc The Load Balancer Pattern allows you to delegate to one of a number of endpoints using a variety of different load balancing policies
The camel-urlrewrite component will allow you to plugin url rewrite mechanism.
This failover load balancer can be configured in following fashion :
from("jetty:http://{host}:{{port}}/{context_1}?matchOnUriPrefix=true")
.loadBalance().failover(Exception.class)
.to("jetty:http://{host}:{{port2}}/context_2?bridgeEndpoint=true&urlRewrite=#myRewrite")
.to("jetty:http://{host}:{{port2}}/{other_context}?bridgeEndpoint=true&urlRewrite=#myRewrite");
The detailed code can be found here : https://github.com/apache/camel/tree/master/components/camel-urlrewrite/src/test/java/org/apache/camel/component/urlrewrite
*This component requires that your Camel routes starts from a servlet based endpoint such as Jetty etc. which your code already have.
Related Camel Doc # http://camel.apache.org/load-balancer.html

Apache 2.4 - Never expire to all files, except 'index.html'

I'm using gulp-rev-all for my Angular based WebApp and I don't want to revision index.html. All other files are revisioned by gulp-rev-all, so they will change their names after each deploy.
How to tell Apache to not cache index.html (always fetch index.html from the server), but all other files in my WebApp must never be expired until I deploy new revision?
Take a look over here, it's some config that will turn off caching based on a pattern:
How to prevent http file caching in Apache httpd (MAMP)

package/packagescan tag in Apache camel

Trying to load the routes from .xml file.Instead of using import resource,or "route context ref".
So i wrote a Routebuilder class with following code
InputStream is = getClass().getResourceAsStream("barRoute.xml");
RoutesDefinition routes = context.loadRoutesDefinition(is);
context.addRouteDefinitions(routes.getRoutes());
and loaded the routes at the time of camelcontext loading.
using
com.***.Loadroutes
I am able to load routes from xml file in standalone.
But when i deploy the bundle to fuse container,routes are not loading from xml file.
How to use package/packagescan in blurprint/spring to run inside fuse
note :made project as osgi specific bundle and normal bundle(mvn camel:run).

Running an Backbone app as an independent JS application - Routes not working

currently, I run backbone as the front-end of my rails 3.2 application. I need to migrate it into an independent JS application, as part of my putting it as part of Trigger.io.
It now exists as its own index.html file, referencing the assets folder.
When I open the file, it loads the Backbone modules, but the page remains empty. And when I run fetch() commands, it
So, I got a couple of qns:
1) How do I trigger the routes such that it goes to a designated page by default?
I know it gets triggered in Backbone.History.Start, but I am not sure what to do before that.
2) The url is "file://localhost/Users/mingyeow/Desktop/index.html"
How do I set the root url manually to use localhost:3000/my web address?
// define router
var Router = Backbone.Router.extend({
routes : {
'index' : 'indexAction',
'*default' : '_defaultAction'
},
indexAction : function() {
// this will be executed when user navigate to #index
},
_defaultAction : function() {
// this will be executed when user navigate anywhere else (#XXX)
}
});
// on document ready
$(function() {
// initialize router
new Router();
// and start history
Backbone.history.start();
});
You can navigate this way.
Or by clicking the link : Index route
You can use python server. To start it type in the Terminal:
$ python -m SimpleHTTPServer
And check http://localhost:8000
1) To trigger a route change you just need to navigate to a page via a href or JavaScript like window.location. Read up on Backbone Routes but essentially you need to write a function for every 'page'. Each function should take care of rendering the page.
2) This should be very simple. You need a local web server. What I started doing recently is just having a simple Node server. Node is very easy to install and its worth experimenting with. Download a static web server such as this one I made. To use it just put your backbone application in a directory named 'public' and run server.js in node.
If you don't want to do this you can run a simple LAMP/WAMP/MAMP installation and set the root of the Apache web server.

Resources