Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pull-20180816 #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified README.md
100644 → 100755
Empty file.
8 changes: 6 additions & 2 deletions springboot-elk/src/main/java/com/forezp/SpringbootElkApplication.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package com.forezp;

import org.apache.log4j.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringbootElkApplication {

private static Logger LOGGER = Logger.getLogger(SpringbootElkApplication.class);

public static void main(String[] args) {
SpringApplication.run(SpringbootElkApplication.class, args);
for(int i = 0; i < 1000; i ++){
LOGGER.info("i is " + i);
}
}



}
Empty file modified springboot-elk/src/main/resources/application.properties
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion springboot-elk/src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ log4j.logger.com.forezp=DEBUG, socket

# appender socket
log4j.appender.socket=org.apache.log4j.net.SocketAppender
log4j.appender.socket.Port=4560
log4j.appender.socket.Port=14560
log4j.appender.socket.RemoteHost=localhost
log4j.appender.socket.layout=org.apache.log4j.PatternLayout
log4j.appender.socket.layout.ConversionPattern=%d [%-5p] [%l] %m%n
Empty file.
Original file line number Diff line number Diff line change
@@ -7,6 +7,11 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.net.ssl.*;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;

/**
* 启动mongodb
* C:\Program Files\MongoDB\Server\3.4\bin
@@ -19,7 +24,27 @@ public class SpringbootMongodbApplication implements CommandLineRunner {
@Autowired
private CustomerRepository repository;

static {
//for localhost testing only
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
new javax.net.ssl.HostnameVerifier(){

public boolean verify(String hostname,
javax.net.ssl.SSLSession sslSession) {
if (hostname.equals("192.168.8.104")) {
return true;
}
return false;
}
});
}



public static void main(String[] args) {
System.setProperty("javax.net.ssl.trustStore", "/etc/ssl/nx.keystore");

System.setProperty("javax.net.ssl.trustStorePassword", "1234567890");
SpringApplication.run(SpringbootMongodbApplication.class, args);
}

11 changes: 11 additions & 0 deletions springboot-mongodb/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
spring.data.mongodb.uri=mongodb://www.localhost.com:27017/push_message_db?ssl=true
#spring.data.mongodb.host=192.168.8.104
#spring.data.mongodb.port=27017
#spring.data.mongodb.repositories.enabled=true
#spring.data.mongodb.database=nx



#spring.data.mongodb.host=192.168.8.104
#spring.data.mongodb.port=27017
#spring.data.mongodb.database=nx
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;


@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringbootMongodbApplicationTests {
@@ -13,4 +14,5 @@ public class SpringbootMongodbApplicationTests {
public void contextLoads() {
}


}
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
package com.forezp;

import java.util.concurrent.TimeUnit;


import com.forezp.message.Receiver;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class Runner implements CommandLineRunner {

private final RabbitTemplate rabbitTemplate;
private final Receiver receiver;
private final ConfigurableApplicationContext context;

public Runner(Receiver receiver, RabbitTemplate rabbitTemplate,
ConfigurableApplicationContext context) {
this.receiver = receiver;
this.rabbitTemplate = rabbitTemplate;
this.context = context;
}

@Override
public void run(String... args) throws Exception {
System.out.println("Sending message...");
rabbitTemplate.convertAndSend(SpringbootRabbitmqApplication.queueName, "Hello from RabbitMQ!");
receiver.getLatch().await(10000, TimeUnit.MILLISECONDS);
context.close();
}

/**
* Sending message...
Received <Hello from RabbitMQ!>
*/
package com.forezp;

import java.util.concurrent.TimeUnit;


import com.forezp.message.Receiver;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;

/**
* 生产者
*/
@Component
public class Sender implements CommandLineRunner {

private final RabbitTemplate rabbitTemplate;
private final Receiver receiver;
private final ConfigurableApplicationContext context;

public Sender(Receiver receiver, RabbitTemplate rabbitTemplate,
ConfigurableApplicationContext context) {
this.receiver = receiver;
this.rabbitTemplate = rabbitTemplate;
this.context = context;
}

@Override
public void run(String... args) throws Exception {
System.out.println("Sending message...");
rabbitTemplate.convertAndSend(SpringbootRabbitmqApplication.queueName, "zf: Hello World!");
receiver.getLatch().await(10000, TimeUnit.MILLISECONDS);
//context.close();
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package com.forezp;

import com.forezp.message.Receiver;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter;
@@ -16,21 +13,21 @@
@SpringBootApplication
public class SpringbootRabbitmqApplication {

final static String queueName = "spring-boot";
final static String queueName = "onlyoffice-client-queue2";

@Bean
Queue queue() {
return new Queue(queueName, false);
}

@Bean
TopicExchange exchange() {
return new TopicExchange("spring-boot-exchange");
FanoutExchange exchange(){
return new FanoutExchange("onlyoffice-client-exchange-file2");
}

@Bean
Binding binding(Queue queue, TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(queueName);
Binding binding(Queue queue, FanoutExchange exchange) {
return BindingBuilder.bind(queue).to(exchange);
}

@Bean
Original file line number Diff line number Diff line change
@@ -3,6 +3,9 @@
import java.util.concurrent.CountDownLatch;
import org.springframework.stereotype.Component;

/**
* 消费者
*/
@Component
public class Receiver {

4 changes: 4 additions & 0 deletions springboot-rabbitmq/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
spring.rabbitmq.host=192.168.8.253
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
spring.redis.host=localhost
spring.redis.port=6379
spring.redis.host=10.111.55.199
spring.redis.port=63799
#spring.redis.password=
spring.redis.database=1
spring.redis.pool.max-active=8
Empty file modified springboot-upload-file/upload-dir/212.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.