27 Temmuz 2023 Perşembe

ActiveMQ Client Kullanımı

Maven
Örnek - Jakarta
Jakarta isim alanını kullanan ilk sürüm 5.18 sürümü. Şu satırı dahil ederiz
<dependency>
<groupId>jakarta.jms</groupId> <artifactId>jakarta.jms-api</artifactId> <version>3.1.0</version> </dependency> <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-client-jakarta</artifactId> <version>5.18.2</version> </dependency>
Örnek
Eğer Javax isim alanını kullanıyorsak şu satırı dahil ederiz
<dependency>
  <groupId>org.apache.activemq</groupId>
  <artifactId>activemq-all</artifactId>
  <version>5.18.2</version>
</dependency>
ActiveMQConnectionFactory veya ActiveMQXAConnectionFactory nesnesi yaratılır

Artemis Server Kullanımı

Maven
Şu satırı dahil ederiz
<dependency>
  <groupId>org.apache.activemq</groupId>
  <artifactId>artemis-server</artifactId>
  <version>2.29.0</version>
</dependency>
Gelen bağımlılıklar şöyle
artemis-jakarta-server
  artemis-commons
  artemis-core-client
  artemis-jakarta-client
  artemis-jakarta-service-extensions
  artemis-journal
  artemis-server
  jakarta-jms-api [provided]
  slf4j-api [provided]
EmbeddedActiveMQ ile sunucu yaratılır

Artemis Client Kullanımı

Maven
Örnek
Şu satırı dahil ederiz
<dependency>
  <groupId>org.apache.activemq</groupId>
  <artifactId>artemis-jakarta-client</artifactId>
  <version>2.29.0</version>
</dependency>
Örnek  - Fat Jar
Şu satırı dahil ederiz
<dependency>
  <groupId>org.apache.activemq</groupId>
  <artifactId>artemis-jakarta-client-all</artifactId>
  <version>2.30.0</version>
</dependency>
ActiveMQConnectionFactory ile sunucuya bağlanılır

23 Temmuz 2023 Pazar

Jakarta EE Servlet Kullanımı

Maven
Örnek
Şu satırı dahil ederiz
<dependency>
<groupId>jakarta.servlet</groupId> <artifactId>jakarta.servlet-api</artifactId> <version>6.0.0</version> </dependency>
Sınıflar şöyle
Cookie
HttpServletResponse
@WebListener Anotasyonu

21 Temmuz 2023 Cuma

Artemis ActiveMQConnectionFactory Sınıfı

Giriş
Şu satırı dahil ederiz
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
constructor
Şöyle yaparız
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616")

Artemis EmbeddedActiveMQ Sınıfı

Giriş
Şu satırı dahil ederiz
import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ;
Örnek
Şu satırı dahil ederiz
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
Şöyle yaparız
public final class ActiveMQBroker {

  public static final String BROKER_URL = "tcp://localhost:61616";

  private EmbeddedActiveMQ broker;

  ActiveMQBroker() throws Exception {
    ConfigurationImpl configuration = new ConfigurationImpl();
    configuration.setSecurityEnabled(false);
    configuration.setPersistenceEnabled(false);
    configuration.addAcceptorConfiguration("my-acceptor", BROKER_URL);

    broker = new EmbeddedActiveMQ();
    broker.setConfiguration(configuration);
    broker.start();
  }

  public void stop() throws Exception {
    broker.stop();
  }
}

Jakarta JMS Kullanımı

Önceden
Maven
Şu satırı dahil ederiz
<dependency> <groupId>javax.jms</groupId> <artifactId>javax.jms-api</artifactId> <version>2.0.1</version> <scope>provided</scope> <optional>true</optional> </dependency>
Jakarta
Maven
Şu satırı dahil ederiz
<dependency> <groupId>jakarta.jms</groupId> <artifactId>jakarta.jms-api</artifactId> <version>3.1.0</version> <scope>provided</scope> <optional>true</optional> </dependency>

Bean Validation @GroupSequence Anotasyonu

Örnek Elimizde şöyle bir kod olsun public class SampleRequest {   @NotNull   LocalDate startDate;   @NotNull   LocalDate endDate;   @AssertT...