Skip to content

Instantly share code, notes, and snippets.

Viktor Lytsus vlytsus

  • Poland
Block or report user

Report or block vlytsus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:a9b87f6a3d7c0e52e5c78bf8a2411d35
@Component("email")
public class EmailStrategy implements NotificationStrategy { ... }
...
@Component("sms")
public class SmsStrategy implements NotificationStrategy { ... }
...
@Service
public class NotificationService() {
@Resource(name = "email")
@vlytsus
vlytsus / UserService.java
Created Feb 21, 2020
Example of @Transactiona method that combines JMS & Database transaction
View UserService.java
private final JmsTemplate jmsTemplate;
private final UserRepository userRepository;
...
@Entity
protected class UserEntity {
@Id public UUID userId;
@NotEmpty public String username;
}
...
@Transactional
View SpringJmsTemplateExample.java
private final JmsTemplate jmsTemplate;
public String sendMessage(String queueName, String payload) {
jmsTemplate.convertAndSend( queueName, payload );
}
You can’t perform that action at this time.