У меня есть пружинный загрузочный верблюд привет мир приложений, которые я хотел бы развернуть в Bluemix:Как я могу прослушивать пользовательский порт с приложением Bluemix Liberty?
import org.apache.camel.spring.boot.*
import org.springframework.boot.*
import org.springframework.boot.autoconfigure.*
import org.springframework.context.*
import org.springframework.context.annotation.*
import org.springframework.scheduling.annotation.*
@Configuration
@ComponentScan
@EnableAutoConfiguration
@SpringBootApplication
class Application extends FatJarRouter {
public static void main(String... args) {
ApplicationContext applicationContext = new SpringApplication(Application.class).run(args);
CamelSpringBootApplicationController applicationController =
applicationContext.getBean(CamelSpringBootApplicationController.class);
applicationController.run();
}
@Override
public void configure() throws Exception {
from("netty4-http:http://0.0.0.0:18080").
setBody().simple("ref:helloWorld");
}
@Bean
String helloWorld() {
return "helloWorld";
}
}
Я также разместить свой build.gradle в случае полезно:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.3.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'spring-boot'
apply plugin: 'eclipse'
jar {
baseName = 'EAI_Service'
version = '0.1.0'
}
repositories {
mavenCentral()
}
dependencies {
compile("org.codehaus.groovy:groovy-all:2.2.1")
compile("org.springframework.boot:spring-boot-starter-web:1.2.3.RELEASE")
compile("org.apache.camel:camel-core:2.17.0")
compile("org.apache.camel:camel-spring-boot-starter:2.17.0")
compile('org.apache.camel:camel-netty4-http:2.17.0')
}
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
В файл журнала Bluemix, я могу видеть, верблюд привязан к порту:
ServerBootstrap binding to 0.0.0.0:18080
Netty consumer bound to: 0.0.0.0:18080
Route: route1 started and consuming from: Endpoint[http://0.0.0.0:18080]
Total 1 routes, of which 1 are started.
Apache Camel 2.17.0 (CamelContext: camel-1) started in 0.590 seconds
Tomcat started on port(s): 61649 (http)
Started Application in 7.345 seconds (JVM running for 9.164)
Apache Camel 2.17.0 (CamelContext: camel-1) is starting
Total 1 routes, of which 1 are started.
Apache Camel 2.17.0 (CamelContext: camel-1) started in 0.000 seconds
Однако «Connection отказался» сообщение возвращается, когда я пытаюсь подключиться.
snowch$ curl <<myapp>>.mybluemix.net:18080
curl: (7) Failed to connect to <myapp>>.mybluemix.net port 18080: Connection refused
В моем случае использования, верблюд использует NETTY прослушивать порт 18080. Я видел question on developerWorks, что говорится, что это не представляется возможным привязать к пользовательскому порту приложения Bluemix Свободы. Есть ли другой способ поддержать этот вариант использования без использования Docker или VM?